I'd suggest checking that you are fully consuming the entire response
from the server before attempting to re-use the connection. Even if
you hit a non-2xx HTTP response code you still need to consume the
response body. The connection will not be re-usable until this is
done.

Failing that, take a look at the first two examples on
http://hc.apache.org/httpcomponents-client-ga/examples.html. These
definitely support consecutive connections with a single HttpClient
instance.

Hope this helps,

Sam



On 19 August 2011 10:35, Jakub Liska <[email protected]> wrote:
> Hey,
>
> could please anybody explain to me, how to release connection for sequential
> request execution with singleton HttpClient instance ? There is no
> HttpMethod as it used to be in httpClient 3.x ...
>
> I setup HttpGet/Post,  get the response httpclient.execute(request); and
> read the stream from its entity and close the stream... But when I want to
> do all this again with a new request, I get "Invalid use of
> SingleClientConnManager: connection still allocated".
>
> It looks it might be done via ClientConnectionManager that I can get from
> httpClient, but it doesn't seem right.
>
> Best Regards, Jakub
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to