Skip navigation links

Package com.enterprisedt.util.proxy

Contains classes for proxy functionality, including SOCKS and HTTP proxies.

See: Description

Package com.enterprisedt.util.proxy Description

Contains classes for proxy functionality, including SOCKS and HTTP proxies.

SOCKS is a very popular protocol for proxying requests. Any TCP or UDP protocol can be relayed via SOCKS proxies. Unlike HTTP proxies, SOCKS supports a bind method that permits SOCKS proxies to listen for incoming connection requests from external servers. This means that active mode FTP and FTPS transfers can be performed through a SOCKS proxy. SOCKS5 is the preferred version of the protocol - SOCKS4 and SOCK4A are earlier versions.

An example of how to use SOCKS5 is shown below. The ProxySettings of the client must be set appropriately.

ProFTPClient ftp = new ProFTPClient();
ftp.getProxySettings().setProxyAddress("myinternalproxyaddress");
ftp.getProxySettings().setProxyPort(1080);
ftp.getProxySettings().setProxyPassword("myuser");
ftp.getProxySettings().setProxyUserName("mypassword");
ftp.getProxySettings().setPublicProxyAddress("mypublicproxy");
ftp.getProxySettings().setProxyType(ProxyType.SOCKS5);

HTTP proxies are proxy servers that work via the HTTP protocol. They permit various protocols to be tunnelled over HTTP via the CONNECT method. This is often useful if the desired protocol (such as FTP) is not permitted to pass through a particular firewall. Instead, it could be tunnelled via an HTTP proxy.

HTTP proxies can only make connections to other servers - they are unable to listen on a port for incoming requests (which SOCKS servers can do). This means that active (or PORT) mode in FTP and FTPS cannot be used with HTTP proxies.

To direct socket communications via an HTTP proxy, the ProxySettings of the client must be set appropriately. An example is shown below:

ProFTPClient ftp = new ProFTPClient();
ftp.getProxySettings().setProxyAddress("myinternalproxyaddress");
ftp.getProxySettings().setProxyPort(8080);
ftp.getProxySettings().setProxyType(ProxyType.HTTP);

Skip navigation links

Copyright 2001-2014 Enterprise Distributed Technologies Ltd. All Rights Reserved.