Constructor and Description |
---|
ProxyHTTP(String proxy_host)
Creates a new ProxyHTTP object.
|
ProxyHTTP(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 80 as defined for HTTP.
|
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 ProxyHTTP(String proxy_host)
proxy_host
- the proxie's host name, maybe including the port
number separated by :
. (The default port is 80.)public ProxyHTTP(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 only Basic Authentication as defined in RFC 2617,
i.e. sending user name and password in plaintext. (Both will be
encoded using first UTF-8 and then Base64.)
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 an inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.