mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 11:17:15 +00:00

- changed var to const - changed assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9885 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
21 lines
584 B
JavaScript
21 lines
584 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
var server = net.createServer(common.mustCall(function(socket) {
|
|
assert.strictEqual(socket.localAddress, common.localhostIPv4);
|
|
assert.strictEqual(socket.localPort, this.address().port);
|
|
socket.on('end', function() {
|
|
server.close();
|
|
});
|
|
socket.resume();
|
|
}));
|
|
|
|
server.listen(0, common.localhostIPv4, function() {
|
|
var client = net.createConnection(this.address().port, common.localhostIPv4);
|
|
client.on('connect', function() {
|
|
client.end();
|
|
});
|
|
});
|