public interface SocketFactory
SocketFactory
, but with the
ability to replace/wrap the Streams without having to subclass
Socket
(and it works with before JDK 1.4, too).
An application may pass an implementation of this interface to the Session to control the creation of outgoing Sockets for port forwardings (to other hosts/ports on the local side) or for the main connection to the remote host.
Modifier and Type | Method and Description |
---|---|
Socket |
createSocket(String host,
int port)
Creates a Socket connected to a given host/port.
|
InputStream |
getInputStream(Socket socket)
Creates an InputStream for a Socket.
|
OutputStream |
getOutputStream(Socket socket)
Creates an OutputStream for a Socket.
|
Socket createSocket(String host, int port) throws IOException, UnknownHostException
host
- the destination host name.port
- the destination port number.IOException
UnknownHostException
InputStream getInputStream(Socket socket) throws IOException
return socket.getInputStream()
,
but advanced implementations may wrap the stream.socket
- a socket created with createSocket(java.lang.String, int)
.IOException
OutputStream getOutputStream(Socket socket) throws IOException
return socket.getOutputStream()
,
but advanced implementations may wrap the stream.socket
- a socket created with createSocket(java.lang.String, int)
.IOException
This is an inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.