diff --git a/test/parallel/test-http-many-ended-pipelines.js b/test/parallel/test-http-many-ended-pipelines.js index 20371e7e562721..f1e3b31aef5966 100644 --- a/test/parallel/test-http-many-ended-pipelines.js +++ b/test/parallel/test-http-many-ended-pipelines.js @@ -29,6 +29,7 @@ console.trace = function() { throw new Error('no tracing should happen here'); }; +const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -51,6 +52,13 @@ const server = http.createServer(function(req, res) { server.listen(0, function() { const client = net.connect({ port: this.address().port, allowHalfOpen: true }); + + client.on('error', function(err) { + // The socket might be destroyed by the other peer while data is still + // being written. + assert.strictEqual(err.code, 'ECONNRESET'); + }); + for (let i = 0; i < numRequests; i++) { client.write('GET / HTTP/1.1\r\n' + 'Host: some.host.name\r\n' +