Refactor code in connection.py

### Motivation
Refactor code in `node/connection.py` so that it is easier to read and test.

### Changelog
* Rewrite methods to bring failure cases in front and avoid multiple nested `if` and `try` statements.
* Optimization: Delay data compression in `PeerConnection.send_raw` until we are sure we'll send them.
* Strip `try-except` from `PeerConnection.create_zmq_socket`; caller already handles exceptions.
* Refactor and DRY `CryptoPeerConnection.check_port`.
  * Prefer ipv6 over ipv4 sockets.
  * Create sockets inside `with` to ensure they are closed upon termination.
* Some other minor style changes.