I am trying to write Java applications that work with proxy-based firewalls. Java provides properties for dealing with FTP and HTTP proxies - is there a way to use a proxy with other Internet protocols?

Tim Rohaly

The java.net.PlainSocketImpl class has built-in support for SOCKS v4 proxies. SOCKS will allow you to tunnel any protocol you want, although version 4 only supports TCP-based protocols.

By setting a few Java system properties, you may open a socket through a SOCKS proxy transparently from your application. These properties are socksProxyHost, which should be set to the fully-qualified host name where you are running the SOCKS proxy, and socksProxyPort, which should be set to the port on which the SOCKS proxy is listening. socksProxyPort defaults to port 1080, which is the customary port for a SOCKS proxy server.

For details on how to set these properties, see the example in the FAQ at: http://www.jguru.com/jguru/faq/view.jsp?EID=9920

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact