Error in the Java Standard Library while using Tor sock proxy

Myers Carpenter myers at maski.org
Thu Dec 2 17:52:35 UTC 2004


I'm using a Java program as a network client on TOR.  It uses the 
standard Java support for SOCKS.  I'm currently using the SOCKS4 
protocol, but I've gotten the same error while using 4, 4a, and 5.  The 
stack trace looks something like this:

Caused by: java.net.SocketException: Reply from SOCKS server contains 
wrong code
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:401)

I googled this error message and found someone had put up the source 
code to the JDK uncompressed and browseable on the web (how useful! 
Wish Sun would do that themselves and let google at it).

http://www.cs.umb.edu/~bill/java/jdk1.4/src/java/net/SocksSocketImpl.java

You searching on that page you can find where it happens, it's right 
after it contacts the SOCKS server for the first time and it's reading 
the response from the server.  It's expecting a int that will signify a 
IPv4 (1) or IPv6 (3) connect request, a DNS lookup request (2), and the 
TOR socks server seems to be returning something that it's not 
expecting.  (Wouldn't have been nice if that error message told us what 
it got that it didn't expect?)

Any ideas?

Thanks,

myers



More information about the tor-talk mailing list