How to solve org.apache.http.NoHttpResponseException

前端 未结 2 1642
名媛妹妹
名媛妹妹 2021-02-09 23:24

I\'m using apache httpclient 4.4 to do https requests, and I can constantly to see org.apache.http.NoHttpResponseException.

Here\'s my code to create the h

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-09 23:48

    Another way around this issue is to configure your org.apache.http.impl.client.AbstractHttpClient httpClient to never reuse connections:

    httpClient.setReuseStrategy(new NoConnectionReuseStrategy());
    

    The same can be configured on a org.apache.http.impl.client.HttpClientBuilder builder:

    builder.setConnectionReuseStrategy(new NoConnectionReuseStrategy());
    

提交回复
热议问题