-1

I read on the Apache HttpClients tutorial that HttpResponse#close() shuts down and discards the connection. My question is when we use a BasicHttpClientConnectionManager which only manages a single connection, I call HttpResponse#close() will I not be able to reuse the same HttpClient because the connection has been shut down and discarded?

Also, when I do not set a Connection Manager explicitly. Which connection manager is used by the client.

My HttpClients version is 4.5.X.

Supersic
  • 232
  • 2
  • 13
  • You could maybe link to the tutorial you are reading, and/or quote the specific lines that you are refering to. It may be valuable to evaluate to what extent the tutorial uses the right specific terminology and/or to what extent you/we understand it right. – GPI Mar 23 '21 at 15:26

1 Answers1

0

When a client calls a remote server, a connection is established on both parties this is called a socket connection. The socket remains active until either parties close it.

To answer your question, you can still use the same HttpClient, but you will create a new connection to make another request

Vishrant
  • 15,456
  • 11
  • 71
  • 120