diff --git a/lib/protocol/Connection.js b/lib/protocol/Connection.js index ac087ae..d1ced47 100644 --- a/lib/protocol/Connection.js +++ b/lib/protocol/Connection.js @@ -241,7 +241,7 @@ Connection.prototype._addListeners = function _addListeners(socket) { function onend() { var err = new Error('Connection closed by server'); err.code = 'EHDBCLOSE'; - socket.emit('error', err); + onerror(err); } socket.on('end', onend); };