This page is for testing JAVA via proxy server.

The Java class encapsulates a TCP/IP network connection is java.net.Socket. It represents a generic network connection, free of any particular software level protocol like HTTP, SMTP, FTP, SSL, etc. Most Web proxy servers perform software protocol level policing, monitoring and caching by interpreting the network data stream of the designated protocol. Obviously, this kind of proxy server is not suitable for a generic connection created by java.net.Socket.

SOCKS is a new emerging proxy server protocol developed by NEC. It is software protocol independent. After the initial handshake and authorization process, a SOCKS proxy server do not care about the content of the data stream. This is perfect for proxying java.net.Socket connections.

Since Java Development Kit 1.0.2, a java.net.Socket instance has the ability to connect to a remote host through a SOCKS proxy server. The condition that triggers this feature is the existence of the System property "socksProxyHost" and optionally "socksProxyPort". Although, the JDK documentation does not clearly spell out this feature, programmers can view the actual implementation in the JDK source file "java/net/PlainSocketImpl.java".

The problem with Netscape Communicator is that it does not convey its proxy server settings to its Java VM by setting the System property "socksProxyHost" and "socksProxyPort". However, with the aid of digital signatures, applets can overcome this deficiency.

Communicator saves most of its configuration, including proxy settings, in the file "prefs.js". Each user of Communicator on the same machine has a separate copy of "prefs.js" in the user's home directory. The solution is for the applet to seek out the proxy server settings then set the relevant System properties. To do all that, the applet must be signed with a digital signature.

The following applet that demonstrates how this may be implemented. This applet uses the generic java.net.Socket class to connect to other remote hosts, send a HTTP request to web server.And it gets the reply from the remote web server. In the source,the most relevant code is the very last method setNavigatorProxyProperties(). This method first locates the "prefs.js" file, loads all preferences into a Properties instance, then sets the appropriate System properties. Note that this applets also works in IE 4.0 and HotJava 1.1, but the setNavigatorProxyProperties() method has no effect.

Click on the "Send" button to send the request to the remote web server. If your machine cannot resolve internet addresses, you must enter the numeric IP adderss of the web server.