I have a node.js (12.18.4) server application which listens for HTTP connections. Our tests use mocha and request, and we make many connections to the server. At the end of the testing, we shut down the server but first we make sure that all connections have been closed by calling server.getConnections and asserting that the value is 0. The vast majority of the time it is, but sometimes the value returned is non-zero, usually around 60-70. We make far more than 60-70 requests during the tests. No tests failed or got stuck.
How can I determine why the server thinks these connections are still around?