Add new SocketClient constructor with timeout and keepalive and fix connection state on disconnect errors.