public interface Proxy
A Proxy object creates a Socket and it's two streams for a remote server. It typically does this by first connecting to a proxy server, negiotiating some conditions (or providing a password) and then returning the streams as the connection will be forwarded to the target host.
The library (i.e. Session
) uses a proxy only if given with
setProxy
before connecting. When connecting,
it will use the methods defined in this interface (except close), and
it will invoke close()
on disconnecting.
Some implementing classes for common proxy types are delivered with
the library: ProxyHTTP
, ProxySOCKS4
, ProxySOCKS5
.
An application might also create their own implementations and provide
these to the session before connecting.
Session.setProxy(com.jcraft.jsch.Proxy)
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
void |
connect(SocketFactory socket_factory,
String host,
int port,
int timeout)
Opens a connection to the target server.
|
InputStream |
getInputStream()
Returns an InputStream to read data from the remote server.
|
OutputStream |
getOutputStream()
Returns an OutputStream to write data to the remote server.
|
Socket |
getSocket()
Returns the socket used for the connection.
|
void connect(SocketFactory socket_factory, String host, int port, int timeout) throws Exception
socket_factory
- a factory for sockets. Might be null
, then
the implementation will use plain sockets.host
- the SSH server host we want to connect to.port
- the port at the SSH server.timeout
- how long to wait maximally for a connection, in
milliseconds. If 0
, wait as long as needed.Exception
- if it was not possible to create the connection to
the target host for some reason.InputStream getInputStream()
OutputStream getOutputStream()
Socket getSocket()
void close()
This is an inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.