I have a signed applet that needs to make HTTP requests back to the
web server. This works well with a direct connection. However, going
through a SOCKS 4 server, I can't seem to make any connection at all.
I've narrowed this down to a very simple call to:
new Socket(myIpAddress, myPortNumber)
I get this exception:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
This happens with IE configured to use the SOCKS server, regardless of
whether I add any code to attempt to use the SOCKS server. In my test
case the server is available directly to the applet, so it seems that
the JVM is trying to use the SOCKS server.
I'm using Java 1.5.0_11 under Win XP.
Any advice or suggestions would be appreciated.
John
John Brayton - 03 Apr 2007 23:37 GMT
Replying to my own earlier message:
Packet-sniffing the transaction, I can see that IE's own requests are
being made through SOCKS v5. However, the applet requests are being
made through SOCKS v4. Is there a way to force a SOCKS request to be
a SOCKS v4 request?
John
> I have a signed applet that needs to make HTTP requests back to the
> web server. This works well with a direct connection. However, going
[quoted text clipped - 23 lines]
>
> John
hiwa - 04 Apr 2007 04:30 GMT
> Replying to my own earlier message:
>
[quoted text clipped - 32 lines]
>
> > John
What is your socksProxyHost system property
setting?
John Brayton - 04 Apr 2007 15:03 GMT
Regardless of whether or not I call System.setProperty with the
"socksProxyHost" and "socksProxyPort" values, the symptoms are the
same. If I don't call System.setProperty(...) with those system
property values, then calling System.getProperty(...) for those
property values returns null for both "socksProxyHost" and
"socksProxyPort".
Some additional info:
* Packet-sniffing with Ethereal shows that IE is making Socks v4
connections; the applet is trying to make Socks v5 connections.
* Perusing JVM code, the "java.net.SocksSocketImpl" class has a setV4
method, but nothing in the JVM ever calls it. Since this works with
Socks v5 servers, but not Socks v4 servers, I suspect this is the
problem.
* The logical thing to do would be to simply call that setV4()
method. But a class has to be within the "java.net" namespace in
order to do so; the method is not public. And trying to creating my
own "java.net.*" class results in a SecurityException, even from a
PrivilegedAction.run() method. I don't believe you can have
"endorsed" classes from within the applet.
Thanks.
John
> > Replying to my own earlier message:
>
[quoted text clipped - 35 lines]
> What is your socksProxyHost system property
> setting?
Andrew Thompson - 04 Apr 2007 15:30 GMT
(applet)
>This happens with IE ..
..
>Any advice or suggestions would be appreciated.
Suggest trying Web Start to launch your applet.
<http://www.physci.org/jws/#jtest>
HTH

Signature
Andrew Thompson
http://www.athompson.info/andrew/