title: REST call :Connection timed out
body: <p>I have a REST URL say - <a href="http://testing.com/account/v1/person/21324" rel="nofollow">http://testing.com/account/v1/person/21324</a></p>
  
  <p>When I call from the browser, I get a JSON response in my browser. But when I call it from a Java call(using <code>HttpURLConnection</code>), it throws an exception "Connection Timed out".</p>
  
  <p>What is the difference between both the request.</p>
  
  <p>Code below:</p>
  
  <pre><code>private static final String targetURL =
          "http://testing.com/account/v1/person/21324";
  URL restServiceURL = new URL(targetURL);
  
  HttpURLConnection httpConnection =
          (HttpURLConnection) restServiceURL.openConnection();
  httpConnection.setRequestMethod("GET");
  httpConnection.setRequestProperty("Accept", "application/json");
  
  if (httpConnection.getResponseCode() != 200) {
      throw new RuntimeException("HTTP GET Request Failed with Error code : "
              + httpConnection.getResponseCode());
  }
  </code></pre>