Fix: APIS-691, Socket error is escalated twice to a connection callback.
Enh: APIS-690, Handle the case when the socket is disconnected by the server.