node/test/parallel/test-net-local-address-port.js
scalkpdev c0d11752d9 test: update net-local-address-port
- 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>
2016-12-03 11:32:02 +01:00

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();
});
});