Proxies help reduce outside security threats while still allowing internal users to access Internet services. While Java makes it easy to write Internet clients, these clients are useless unless they can get past your proxy. The secret to combining Java and proxies lies in activating certain system properties in the Java runtime. These properties appear to be undocumented, and are whispered between programmers as part of the Java folklore. In order to work with a proxy, your Java application needs to specify information about the proxy itself as well as specify user information for authentication purposes.
Some proxies require a user to type in a username and password before Internet access is granted.
You've probably encountered this behavior if you use a Web browser behind a firewall. This method allows you to manipulate the HTTP headers before the request is sent out. HTTP requires the user name and password to be base64 encoded. As you can see, there's not a whole lot to adding proxy support to your Java application. You can then make your connection using Socks4.