title: HTTPClient cuts off response before done
body: <p>I am writing tests for a RESTful API using Apache <a href="http://hc.apache.org" rel="nofollow">HTTPClient</a>, and when I do a large request (over 80,000 characters returned), the response is cut off. The point of cut off is usually around 85,275. I can run the exact same request from the command line in curl and get the entire statement back.</p>
  
  <p>The system I am hitting is running Tomcat, and the server logs indicate the entire response is being returned, so it seems to me like the problem is in the way HTTPClient is bringing back in the data.</p>
  
  <p>I've done this both with <a href="http://code.google.com/p/rest-assured/" rel="nofollow">Rest Assured</a> (which uses HTTPClient) and HTTPClient directly to make sure the issue wasn't with Rest Assured. I have altered several parameters including CoreConnectionPNames parameters CONNECTION_TIMEOUT, MAX_LINE_LENGTH, SO_TIMEOUT, and SOCKET_BUFFER_SIZE .</p>
  
  <p>As examples, in Rest Assured</p>
  
  <pre><code>given()
      .param("areaCode", "515")
      .param("quantity", "5000")
  .expect()
      .statusCode(200)
      .body("SearchResults.ResultCount", equalTo("5000"),
            "SearchResults.TelephoneNumberList.TelephoneNumber[0]", startsWith("515"),
            "SearchResults.TelephoneNumberList.TelephoneNumber[1]", startsWith("515"),            
            "SearchResults.TelephoneNumberList.TelephoneNumber[2]", startsWith("515"))
  .when()
      .get("/accounts/1/availableNumbers");
  </code></pre>
  
  <p>or in HTTPClient</p>
  
  <pre><code>// I've set up an httpclient with standard stuff to ignore the self-signed 
  // certs in our development environment
  DefaultHttpClient httpclient = getNewHttpClient();
  
  httpclient.getCredentialsProvider().
      setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
                     new UsernamePasswordCredentials("xxxx", "xxxx"));
  
  org.apache.http.client.utils.URIBuilder builder = 
      new org.apache.http.client.utils.URIBuilder();
  
  builder.setScheme("https")
      .setHost("api.test.xxxx.com")
      .setPath("/accounts/1/availableNumbers")
      .setParameter("areaCode", "515")
      .setParameter("quantity", "5000");
  
  URI uri = builder.build();
  
  HttpGet httpget = new HttpGet(uri);
  
  // print out request URI
  System.out.println(httpget.getURI());
  
  HttpResponse response = httpclient.execute(httpget);
  
  if (response.getStatusLine().getStatusCode() != 200)
  {
      throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
  }
  
  BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent())));
  
  String output;
  System.out.println("Output from Server .... \n");
  while ((output = br.readLine()) != null)
  {
     System.out.println(output);
  }
  </code></pre>