Rescuing and repairing broken connections

* Resets the socket and reestablishes the connection on SSLError or
Errno::EPIPE
* Logs error occurrences with socket state for further investigation.
* Fixes #37