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: nodejs#24087
Refs: nodejs#23937
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Ajido authored and refack committed Jan 10, 2019
1 parent cd97c5f commit f4bd08e
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 f4bd08e

Please sign in to comment.