title: How to solve org.apache.http.NoHttpResponseException
body: <p>I'm using apache httpclient 4.4 to do https requests, and I can constantly to see  <code>org.apache.http.NoHttpResponseException</code>.</p>
  
  <p>Here's my code to create the httpclient.</p>
  
  <pre><code>   TrustManager[] trustAllCerts =
           new TrustManager[] { new X509TrustManager() {
              @Override
              public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                 return null;
              }
  
              @Override
              public void checkClientTrusted(X509Certificate[] certs,
                    String authType) {
              }
  
              @Override
              public void checkServerTrusted(X509Certificate[] certs,
                    String authType) {
              }
  
           } };
     SSLContext sslcontext = null;
     try {
        sslcontext = SSLContext.getInstance("SSL");
        sslcontext.init(null, trustAllCerts, new java.security.SecureRandom());
     } catch (NoSuchAlgorithmException e) {
        logger.warn(e.getMessage());
     } catch (KeyManagementException e) {
        logger.warn(e.getMessage());
     }
     // Allow TLSv1 protocol only
     final SSLConnectionSocketFactory sslsf =
           new SSLConnectionSocketFactory(sslcontext,
                 new String[] { "TLSv1" }, null, NoopHostnameVerifier.INSTANCE);
  
     Registry&lt;ConnectionSocketFactory&gt; socketFactoryRegistry = RegistryBuilder
           .&lt;ConnectionSocketFactory&gt; create().register("https", sslsf)
           .build();
     PoolingHttpClientConnectionManager cm =
           new PoolingHttpClientConnectionManager(socketFactoryRegistry);
  
     // Increase max total connection to 200
     cm.setMaxTotal(200);
     // Increase default max connection per route to 20
     cm.setDefaultMaxPerRoute(20);
  </code></pre>
  
  <p>Before execute the request, I do <code>cm.closeExpiredConnections();</code> and <code>conMgr.closeIdleConnections(30, TimeUnit.SECONDS)</code>.  I added this after I read the answer of <a href="https://stackoverflow.com/questions/10558791/apache-httpclient-interim-error-nohttpresponseexception">this question</a></p>
  
  <p>Anything more I need to do?</p>