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.
System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", "proxyHost" );
System.getProperties().put( "proxyPort", "85" );
Some proxies require a user to type in a username and password before Internet access is granted. Here's how to perform the authentication:
URLConnection connection = url.openConnection();
String password = "username
assword";
String encodedPassword = base64Encode( password );
connection.setRequestProperty( "Proxy-Authorization", encodedPassword );