java runtime 6 with socks v5 proxy - Possible?

后端 未结 2 697
深忆病人
深忆病人 2021-02-15 22:59

I have written an application that (amongst other things) runs a local service in windows that acts as a SOCKS v5 proxy for Firefox.

I\'m in the debugging phase right no

2条回答
  •  逝去的感伤
    2021-02-15 23:39

    JRE certainly supports Socks V5. I have been using it since Java 1.4. JRE only uses V4 if your SOCKS server is V4. The first byte from your server response must be 5.

    The V4 support was buggy. It only works with IP address, not domain name because it doesn't know how to resolve the domain name before hand. So you must be use V5 if Socks works at all.

    I suspect that your proxy setting is incorrect so socks doesn't work at all. This should be easy to trace with Wireshark. Just check which port the applet is using.

    Also the stacktrace will be very helpful. It will show you if Socks is used. For example,

    load: class test.MyApplet.class not found.
    java.lang.ClassNotFoundException: .class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    
    Caused by: java.net.SocketException: Malformed reply from SOCKS server
    at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    

    I pointed SOCKS proxy to my HTTP server so this error is expected.

提交回复
热议问题