Http(s) Agent: handle errors on idle sockets
This is my proposed fix for #3595 (closed).
This change adds a new error handler on every socket when the socket is idle.
If there is an error on the tcp connection, eg: the server abruptly close the connection while the socket is idle then we destroy the socket and remove it from the pool of free sockets.