Fix various bugs with connection pool handling

* Adding requests to the queue used wrong parameters.
* onCloseOrRemove() didn't remove sockets from the pool.
* When using TLS, the pool contained the underlying connection instead
  of the TLS wrapped connection, causing connections to never be
  removed.
* When a connection was closed and removeSocket() created a new socket
  to process requests in the queue, the event handlers were not attached
  to the new socket, causing the new socket to not be removed from the
  pool when it closed.