-
-
Notifications
You must be signed in to change notification settings - Fork 147
Description
In theory, you can reuse the same Socket instance for multiple HTTP requests. There's a bunch of Socket pools in the Agent and the agent decides which socket to use at which time.
That being said, I don't believe we allow our MockHttpSocket
to be used that way. For once, each Socket instance has its own HTTP request/response parser instances, and I'm not sure if reusing sockets implies parallel reusing or sequential. I bet on sequential but who knows.
The tests for this are in works here: #560. I wasn't able to even recreate a raw, unmocked scenario of how you can reuse a socket like that. There's a solid chance I misread the Node.js docs and sockets cannot be used that way. No matter way I do with a keepalive socket/request, it never gets reused.