Skip to content

Commit 8b5ca48

Browse files
LekoMylesBorins
authored andcommitted
test: try to connect after server was closed
PR-URL: #18257 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 91f2cf9 commit 8b5ca48

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎test/parallel/test-net-connect-handle-econnrefused.js‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ const assert = require('assert');
2727
constserver=net.createServer();
2828
server.listen(0);
2929
constport=server.address().port;
30-
constc=net.createConnection(port);
31-
32-
c.on('connect',common.mustNotCall());
33-
34-
c.on('error',common.mustCall((e)=>{
35-
assert.strictEqual('ECONNREFUSED',e.code);
30+
server.close(common.mustCall(()=>{
31+
constc=net.createConnection(port);
32+
c.on('connect',common.mustNotCall());
33+
c.on('error',common.mustCall((e)=>{
34+
assert.strictEqual('ECONNREFUSED',e.code);
35+
}));
3636
}));
37-
server.close();

0 commit comments

Comments
(0)