Java socks4 client

javasocks

Java.net.Proxy supports socks5, is there a way to support socks4 as well? third party library is ok too.

Best Answer

java.net.Proxy SHOULD support SOCKSv4 but doesn't in either OpenJDK6 or OpenJDK7. I am planning to file a bug.

But the SOCKSv4 code is already there and can be turned on.

Use reflection to pull out the impl field in a java.net.Socket object. Cast that object to java.net.SocksSocketImpl. Use reflection to set the useV4 boolean field in this object to true.

Then connect and it should use SOCKSv4.

Related Topic