title: How to solve NoHttpresponseException for Spring RestTemplate
body: <p>I am using RestTemplate in order to invoke external REST APIs from my Spring boot application as follows:</p>
  <pre><code>  @Bean(&quot;myRestTemplate&quot;)
    public RestTemplate restTemplate(RestTemplateBuilder builder) {
  
      return builder
          .setConnectTimeout(Duration.ofMillis(connectionTimeout))
          .setReadTimeout(Duration.ofMillis(readTimeout))
          .build();
    }
  </code></pre>
  <p>Here, while calling external API, getting following error intermittently:</p>
  <pre><code>exception is org.apache.http.NoHttpResponseException: xyz.com:443 failed to respond
  </code></pre>
  <p>I am using this <code>RestTemplate from spring-web 5.2.9.RELEASE.</code></p>
  <p>In this context, I have gone through the following posts:</p>
  <ol>
  <li><a href="https://stackoverflow.com/questions/10558791/apache-httpclient-interim-error-nohttpresponseexception">Apache HttpClient Interim Error: NoHttpResponseException</a>. But it deals with HttpClient mostly.</li>
  <li><a href="https://stackoverflow.com/questions/51379786/rest-template-org-apache-http-nohttpresponseexcep">Rest Template org.apache.http.NoHttpResponseException</a>, here also I could not figure out how to solve this for <code>RestTemplate</code></li>
  </ol>
  <p>Could anyone please help here?</p>