move connection into sub-package
notice disconnection eagerly, not during request

This changes Connection to be constantly reading messages from the server, so
that it notices a disconnection as soon as it happens, instead of when the
client tries to perform a request.