1

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

user12145
  • 1,115
  • 6
  • 28
  • 47

1 Answers1

1

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.

user35670
  • 11
  • 1
  • 1
    @Zombies - how so? Surely this issue predates any possible influence of Oracle culture on the Java team. – Stephen C Feb 27 '10 at 02:03
  • Actually Oracle has been influencing java for some time, at least/best democratically, but now they have free reign. – Zombies Mar 01 '10 at 14:59