public class PseudoTcpSocketFactory extends SocketFactory implements SocketImplFactory
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECT_TIMEOUT
Default timeout for connect operation
|
static long |
DEFAULT_CONVERSATION_ID
Default conversation ID
|
Constructor and Description |
---|
PseudoTcpSocketFactory() |
Modifier and Type | Method and Description |
---|---|
private void |
connectSocket(Socket socket,
InetSocketAddress remoteSockAddr) |
Socket |
createBoundSocket(InetSocketAddress sockAddr)
Creates socket bound to local sockAddr
|
PseudoTcpSocket |
createSocket()
Creates the PseudoTcp socket and binds it to any available port
on the local host machine.
|
PseudoTcpSocket |
createSocket(DatagramSocket datagramSocket)
Creates a socket that will run on given datagramSocket
|
Socket |
createSocket(InetAddress host,
int port)
Creates a socket and connect it to the specified remote address
on the specified remote port.
|
Socket |
createSocket(InetAddress address,
int port,
InetAddress localAddress,
int localPort)
Creates a socket and connects it to the specified remote host on the specified remote port.
|
Socket |
createSocket(String host,
int port)
Creates a socket and connects it to the specified
port number at the specified address.
|
Socket |
createSocket(String host,
int port,
InetAddress localHost,
int localPort)
Creates a socket and connects it to the specified remote host at the specified remote port.
|
SocketImpl |
createSocketImpl() |
getDefault
public static final long DEFAULT_CONVERSATION_ID
public static final int DEFAULT_CONNECT_TIMEOUT
public Socket createSocket(String host, int port) throws IOException, UnknownHostException
createSocket
in class SocketFactory
IOException
UnknownHostException
public Socket createSocket(InetAddress host, int port) throws IOException
createSocket
in class SocketFactory
IOException
private void connectSocket(Socket socket, InetSocketAddress remoteSockAddr) throws IOException
IOException
public Socket createBoundSocket(InetSocketAddress sockAddr) throws IOException
sockAddr
- address for the pseudo socketIOException
- if the socket could not be opened, or the socket
could not bind to the specified local port.public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException
createSocket
in class SocketFactory
IOException
UnknownHostException
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException
createSocket
in class SocketFactory
IOException
public PseudoTcpSocket createSocket(DatagramSocket datagramSocket) throws SocketException
datagramSocket
- the socket to run onSocketException
- if there is an error in the underlying protocol,
such as a TCP error.public PseudoTcpSocket createSocket() throws SocketException
wildcard
address,
an IP address chosen by the kernel.createSocket
in class SocketFactory
SocketException
public SocketImpl createSocketImpl()
createSocketImpl
in interface SocketImplFactory
Copyright © 2018. All rights reserved.