Connecting thru a proxy server |
The Sftp component allows for connections through HTTP and SOCKS5 proxy servers. To use a proxy server invoke the Sftp#setProxyHost method passing a proxy hostname and port as arguments.
Example
// proxy information String proxyHost = "10.0.0.1"; int proxyPort = 2121;
// create Sftp instance and set proxy information Sftp sftp = new Sftp(params); sftp.setProxyHost(proxyHost,proxyPort); sftp.setProxyType("SOCKS5"); sftp.connect();
If your proxy requires authentication you can set this using the Sftp#setProxyAuthentication method.
Example
String proxyUsername = "jsmith"; String proxyPassword = "secret";
ftps.setProxyAuthentication(proxyUsername,proxyPassword);
See also
Connecting from behind a firewall
|