Connect via socket through a Proxy
You have to set the following properties :      proxySet, proxyHost and proxyPort.
 
This can be done when starting the JVM for a JAVA application : java -DproxySet=true -DproxyHost=myProxyServer.come -DproxyPort=80 MyJavaApp
 
Or in your source : import java.util.Properties;
...Properties systemSettings = System.getProperties();
systemSettings.put("proxySet", "true");
systemSettings.put("proxyHost", "myProxyServer.com");
systemSettings.put("proxyPort", "80");
System.setProperties(systemSettings); --------------------------------------------------------------------------------
NOTE:
You might need to identify yourself to the proxy server. Use the HTTP property "Proxy-Authorization" with a username:password base64 encoded. Properties systemSettings = System.getProperties();
...
System.setProperties(systemSettings);URL url=new URL("http://someserver/somepage");
URLConnection uc = url.openConnection ();
String encoded = new String(Base64.base64Encode(new String("username:password").getBytes()));
uc.setRequestProperty("Proxy-Authorization", "Basic " + encoded);
uc.connect();