diff --git a/test/simple/test-http-destroyed-socket-write2.js b/test/simple/test-http-destroyed-socket-write2.js index f72086dc649..3347f3ccc9a 100644 --- a/test/simple/test-http-destroyed-socket-write2.js +++ b/test/simple/test-http-destroyed-socket-write2.js @@ -61,7 +61,18 @@ server.listen(common.PORT, function() { req.on('error', function(er) { assert(!gotError); gotError = true; - assert(er.code === 'ECONNRESET', 'Expected ECONNRESET, got ' + er.code + ' ' + er.syscall); + switch (er.code) { + // This is the expected case + case 'ECONNRESET': + // On windows this sometimes manifests as ECONNABORTED + case 'ECONNABORTED': + break; + default: + assert.strictEqual(er.code, + 'ECONNRESET', + 'Writing to a torn down client should RESET or ABORT'); + break; + } clearTimeout(timer); console.log('ECONNRESET was raised after %d writes', writes); test();