title: Using setReadTimeout in HttpURLConnection with proxy settings
body: <p>I am trying to connect to the internet with the user defined proxy settings. I have set the <code>setReadTimeout</code> to 5 seconds. If the configured proxy is not correct, then we wont be able to connect to internet and i am using the following code, but the read time out is not at all happening.</p>
  
  <pre><code>            URL u = new URL("http://www.google.com/");
              System.out.println("Checking internet connection availability.....");
              System.setProperty("java.net.useSystemProxies", "true");
              System.setProperty("http.proxyHost", proxyHost);
              System.setProperty("http.proxyPort", proxyPort);
              HttpURLConnection uc = (HttpURLConnection) u.openConnection();
              uc.setReadTimeout(5000);
              System.out.println("Response code : " + uc.getResponseCode());
              System.out.println("Internet connection is available.....");
  </code></pre>
  
  <p>If i run the above code, then program is keep on executing and not getting terminated in 5 seconds.</p>
  
  <p>Can anybody help me out here about the problem in my code ?</p>
  
  <p>Thanks in advance.</p>