Avoid infinite waiting for writes when a connection was is terminated by the remote peer in the libevent driver.
Avoid closing a connection that was possibly closed by the server already (and the resulting exception).
Avoid deprecated behavior when using readAllUTF8().