diff --git a/lib/connection.js b/lib/connection.js index 8744bbe32..b972f61b4 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -309,7 +309,9 @@ Connection.prototype.end = function () { // 0x58 = 'X' this.writer.add(emptyBuffer) this._ending = true - return this.stream.write(END_BUFFER) + + this.stream.write(END_BUFFER) + return this.stream.end() } Connection.prototype.close = function (msg, more) { diff --git a/test/unit/test-helper.js b/test/unit/test-helper.js index 6cd2d24e0..e9f9e6279 100644 --- a/test/unit/test-helper.js +++ b/test/unit/test-helper.js @@ -17,6 +17,8 @@ p.write = function (packet) { this.packets.push(packet) } +p.end = function () {} + p.setKeepAlive = function () {} p.writable = true