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.
Since it is only used in a single place inside the class, I suggest making it a private method. If anyone comes up with a nice docstring, I 'll be more than happy to add it.