Skip to content

Commit

Permalink
test: try to connect after server was closed
Browse files Browse the repository at this point in the history
PR-URL: #18257
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Leko authored and MylesBorins committed Feb 21, 2018
1 parent 91f2cf9 commit 8b5ca48
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/parallel/test-net-connect-handle-econnrefused.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ const assert = require('assert');
const server = net.createServer();
server.listen(0);
const port = server.address().port;
const c = net.createConnection(port);

c.on('connect', common.mustNotCall());

c.on('error', common.mustCall((e) => {
assert.strictEqual('ECONNREFUSED', e.code);
server.close(common.mustCall(() => {
const c = net.createConnection(port);
c.on('connect', common.mustNotCall());
c.on('error', common.mustCall((e) => {
assert.strictEqual('ECONNREFUSED', e.code);
}));
}));
server.close();

0 comments on commit 8b5ca48

Please sign in to comment.