I am writing Java code that attempts to make a connection to the Internet behind a proxy and fetches stock prices using the following code:
System.getProperties().put("proxySet", "true"
System.getProperties().put("proxyHost",proxyHost);
System.getProperties().put("proxyPort",proxyPort);
URL sURL = new URL("String a = "myproxyname:myproxypassword";
String b = "Basic " + new sun.misc.BASE64Encoder().encode(a.getBytes());
HttpURLConnection sConnect = (HttpURLConnection)sURL.openConnection();
sConnect.setRequestProperty("Proxy-Authorization", b);
But when I attempt to connect, I get "java.net.NoRouteToHostException: Operation timed out". The site is definately up because I get to it with my browser ok using the same proxy name and password I use in the code. I am using JDK 1.2.2_005. What could be the problem? Thanks.
System.getProperties().put("proxySet", "true"
System.getProperties().put("proxyHost",proxyHost);
System.getProperties().put("proxyPort",proxyPort);
URL sURL = new URL("String a = "myproxyname:myproxypassword";
String b = "Basic " + new sun.misc.BASE64Encoder().encode(a.getBytes());
HttpURLConnection sConnect = (HttpURLConnection)sURL.openConnection();
sConnect.setRequestProperty("Proxy-Authorization", b);
But when I attempt to connect, I get "java.net.NoRouteToHostException: Operation timed out". The site is definately up because I get to it with my browser ok using the same proxy name and password I use in the code. I am using JDK 1.2.2_005. What could be the problem? Thanks.