test: add failing "error" event catching test

Right now the ECONNREFUSED error is an uncaught exception :(
https-proxy-agent: remove use of `this` as much as possible

Also fix the case where `secureEndpoint` was false,
but no "port" was passed in...
https-proxy-agent: listen for the "error" event of the socket

Fixes the failing test case