通常没有必要这样做。 但是,如果使用启用了 keepAlive 的代理,则最好在不再需要代理时显式关闭该代理。 否则,套接字可能会在服务器终止它们之前保持打开很长时间。

Destroy any sockets that are currently in use by the agent.

It is usually not necessary to do this. However, if using an agent with keepAlive enabled, then it is best to explicitly shut down the agent when it is no longer needed. Otherwise, sockets might stay open for quite a long time before the server terminates them.