Constructor and Description |
---|
ProxySOCKS5(String proxy_host)
Creates a new ProxySOCKS5 object.
|
ProxySOCKS5(String proxy_host,
int proxy_port)
Creates a new ProxyHTTP object.
|
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.
|
static int |
getDefaultPort()
returns the default proxy port - this is 1080 as defined for SOCKS.
|
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 |
setUserPasswd(String user,
String passwd)
Sets the user name and password needed for authentication
to the proxy.
|
public ProxySOCKS5(String proxy_host)
proxy_host
- the proxie's host name, maybe including the port
number separated by :
. (The default port is 1080.)public ProxySOCKS5(String proxy_host, int proxy_port)
proxy_host
- the proxie's host name.proxy_port
- the port number of the proxy.public void setUserPasswd(String user, String passwd)
If the proxy needs authentication, this method should be called
before calling connect(com.jcraft.jsch.SocketFactory, java.lang.String, int, int)
(i.e. before passing the Proxy
object to the JSch library).
This class supports the "No Authentication Required" method as well
as the "UserName/Password" method.
user
- the user namepasswd
- the password.public void connect(SocketFactory socket_factory, String host, int port, int timeout) throws JSchException
Proxy
connect
in interface Proxy
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.JSchException
public InputStream getInputStream()
Proxy
getInputStream
in interface Proxy
public OutputStream getOutputStream()
Proxy
getOutputStream
in interface Proxy
public Socket getSocket()
Proxy
public void close()
Proxy
public static int getDefaultPort()
This is a simplified version of the inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.