title: Apache HttpClient Interim Error: NoHttpResponseException
body: <p>I have a webservice which is accepting a POST method with XML. It is working fine then at some random occasion, it fails to communicate to the server throwing IOException with message <code>The target server failed to respond</code>. The subsequent calls work fine. </p>
  
  <p>It happens mostly, when i make some calls and then leave my application idle for like 10-15 min. the first call which I make after that returns this error. </p>
  
  <p>I tried couple of things ... </p>
  
  <p>I setup the retry handler like</p>
  
  <pre><code>HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() {
  
              public boolean retryRequest(IOException e, int retryCount, HttpContext httpCtx) {
                  if (retryCount &gt;= 3){
                      Logger.warn(CALLER, "Maximum tries reached, exception would be thrown to outer block");
                      return false;
                  }
                  if (e instanceof org.apache.http.NoHttpResponseException){
                      Logger.warn(CALLER, "No response from server on "+retryCount+" call");
                      return true;
                  }
                  return false;
              }
          };
  
          httpPost.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
  </code></pre>
  
  <p>but this retry never got called. (yes I am using right instanceof clause). While debugging this class never being called. </p>
  
  <p>I even tried setting up <code>HttpProtocolParams.setUseExpectContinue(httpClient.getParams(), false);</code> but no use. Can someone suggest what I can do now? </p>
  
  <p><strong>IMPORTANT</strong>
  Besides figuring out why I am getting the exception, one of the important concerns I have is why isn't the retryhandler working here? </p>