1 11 package org.eclipse.jdi.internal.connect; 12 13 14 import java.io.IOException ; 15 16 import com.sun.jdi.connect.Transport; 17 import com.sun.jdi.connect.spi.Connection; 18 import com.sun.jdi.connect.spi.TransportService.ListenKey; 19 20 public class SocketTransportImpl implements Transport { 21 public static final String TRANSPORT_NAME = "dt_socket"; public static final int MIN_PORTNR = 0; 23 public static final int MAX_PORTNR = 65535; 24 25 SocketTransportService service; 26 private ListenKey fListenKey; 27 28 31 public SocketTransportImpl() { 32 service = new SocketTransportService(); 33 } 34 35 38 public String name() { 39 return TRANSPORT_NAME; 40 } 41 42 public Connection attach(String hostname, int port, long attachTimeout, long handshakeTimeout) throws IOException { 43 return service.attach(hostname, port, attachTimeout, handshakeTimeout); 44 } 45 46 public String startListening(int port) throws IOException { 47 fListenKey = service.startListening(port+""); return fListenKey.address(); 49 } 50 51 public void stopListening() throws IOException { 52 service.stopListening(fListenKey); 53 } 54 55 public Connection accept(long attachTimeout, long handshakeTimeout) throws IOException { 56 return service.accept(fListenKey, attachTimeout, handshakeTimeout); 57 } 58 59 60 } 61 | Popular Tags |