I am getting Connection timed out: connect.
My code:
System.setProperty("http.proxyHost", "proxy.mycompany.com");
System.setProperty("http.proxyPort", "8080");
String url = URL_BASE + "&limit=5";
URL u = new URL(url);
BufferedReader in = new BufferedReader(
new InputStreamReader(
u.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
If you’re fetching a URL on HTTPS, then you must set
https.proxyHostandhttps.proxyPort. See documentation on Java Networking and Proxies, section 2.2.assuming that
proxy.mycompany.comon port8080is also an HTTPS proxy