title: Spring RestTemplate Connection Timeout
body: <p>Any help or hint would be greatly appreciated it.
  I tried the below RestTemplate code in Eclipse and Intellij and I get the same connection timeout error. If I run it on a browser I am able to connect.</p>
  <p><a href="https://i.stack.imgur.com/y2K2W.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>org.springframework.web.client.ResourceAccessException: I/O error on GET request for &quot;https://registry-relationship-dev.api.non-prod-uw2.hponecloud.io/ocrel-registry/v2/node/sub.node.0025s&quot;: Connection timed out: connect; nested exception is java.net.ConnectException: Connection timed out: connect</p>
  <pre><code>               try {                 
              String tempUrl = registryUrl;
              if (roleInput.getNodeId() != null) {
                  tempUrl  = tempUrl + roleInput.getNodeId();
              }
  
              URI uri = new URI(tempUrl);
              HttpHeaders headers = new HttpHeaders();
              headers.setContentType(MediaType.APPLICATION_JSON);
              headers.set(&quot;Authorization&quot;,auth);
              headers.set(&quot;Content-Type&quot;,&quot;application/json&quot;);
              HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(&quot;parameters&quot;,headers);
              RestTemplate restTemplate = new RestTemplate();
          //  ResponseEntity&lt;String&gt; response = restTemplate.exchange(tempUrl,HttpMethod.GET, entity,String.class);
              ResponseEntity&lt;NodeModel&gt; response1 = restTemplate.exchange(tempUrl,HttpMethod.GET, entity,NodeModel.class);
              NodeModel response = restTemplate.getForObject(&quot;https://registry-relationship-dev.api.non-prod-uw2.hponecloud.io/ocrel-registry/v2/node/sub.node.0025s&quot;,NodeModel.class);
  
              System.out.println(&quot;response from registry:&quot;+response);
          }
          log.info(&quot;createRole,After call authLibService.validateToken(auth):&quot;+auth);
      } catch (Exception e) {
          log.error(&quot;Failed to check permission, createRole getMessage error: {}&quot;, e.getMessage());
          log.error(&quot;Failed to check permission, createRole getStackTrace error: {}&quot;, e.getStackTrace());
          return new ResponseEntity&lt;&gt;(HttpStatus.UNAUTHORIZED);
      }
  </code></pre>