Skip to content

Commit

Permalink
test: add test for socket.end callback
Browse files Browse the repository at this point in the history
PR-URL: #24087
Refs: #23937
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Ajido authored and BethGriggs committed Feb 11, 2019
1 parent f9933ff commit 4093572
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/parallel/test-net-socket-end-callback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const common = require('../common');
const net = require('net');

const server = net.createServer((socket) => {
socket.resume();
}).unref();

server.listen(common.mustCall(() => {
const connect = (...args) => {
const socket = net.createConnection(server.address().port, () => {
socket.end(...args);
});
};

const cb = common.mustCall(() => {}, 3);

connect(cb);
connect('foo', cb);
connect('foo', 'utf8', cb);
}));

0 comments on commit 4093572

Please sign in to comment.