Allows for the sockets that are passed through to not be overridden
This re-adds in functionality that was broken in #2171 with regards to passing existing sockets into pg. This was causing things like SOCKS proxies to fail.
Checks to see if the base stream is pending or not (implies socket stream and not Stream.duplex) connecting is unreliable. Sad Node v14 got rid of .readyState but such is life.
NOTE: I had to also add in a process.nextTick() to allow for something like https://www.npmjs.com/package/socks to properly allow for all the events to fire in order. I'm pretty sure this is going to be controversial, but it was the only way it seams to make sure everything fires in order and as expected.
We'd love to see support for SOCKS proxies through something like this