2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-12-01 10:04:59 -06:00
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const net = require('net');
|
2012-12-31 21:01:42 -05:00
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
const server = net.createServer(common.mustCall(function(socket) {
|
2016-12-01 10:04:59 -06:00
|
|
|
assert.strictEqual(socket.localAddress, common.localhostIPv4);
|
|
|
|
assert.strictEqual(socket.localPort, this.address().port);
|
2012-12-31 21:01:42 -05:00
|
|
|
socket.on('end', function() {
|
|
|
|
server.close();
|
|
|
|
});
|
|
|
|
socket.resume();
|
2016-07-15 15:43:24 -04:00
|
|
|
}));
|
2012-12-31 21:01:42 -05:00
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
server.listen(0, common.localhostIPv4, function() {
|
2017-01-08 13:19:00 +00:00
|
|
|
const client = net.createConnection(this.address()
|
|
|
|
.port, common.localhostIPv4);
|
2012-12-31 21:01:42 -05:00
|
|
|
client.on('connect', function() {
|
|
|
|
client.end();
|
|
|
|
});
|
|
|
|
});
|