Added a log message for debugging connections

Added a line to log the contents of connection failures, when trying to
connect to a server.
Added handling for connection closing early

Added a line to handle the connection closing before the sequence of
responses is complete.