Using a long connection when connecting can 有概率实现this requirement. The use of ports in the HTTP protocol should be transparent to you. You cannot and do not need to know which specific port is actually used by the HTTP protocol provider to connect. If you want to achieve this requirement, you should rewrite HTTP yourself and never abandon these HTTP packets.
See if this article is helpful to you.
HttpClient4.3 Tutorial Chapter 2 Connection Management
It’s best to read the English description on the official website Chapter 2. Connection management
Someone in OSChina raised a similar question about httpClient releasing links
Then, this article is about httpClient httpclient before 4.x, how to maintain the session
Using a long connection when connecting can
有概率实现
this requirement.The use of ports in the HTTP protocol should be transparent to you. You cannot and do not need to know which specific port is actually used by the HTTP protocol provider to connect. If you want to achieve this requirement, you should rewrite HTTP yourself and never abandon these HTTP packets.
Use HttpClientBuilder