Fix bug in Client

I found minor bugs that the no error event was emitted if there is error during socket.conneect.