1'use strict'; 2 3const common = require('../common'); 4const net = require('net'); 5const { strictEqual } = require('assert'); 6 7const server = net.createServer(); 8 9server.listen(common.mustCall(function() { 10 const socket = net.connect({ port: server.address().port }); 11 12 strictEqual(socket.connecting, true); 13 strictEqual(socket.remoteAddress, undefined); 14 15 socket.on('connect', common.mustCall(function() { 16 strictEqual(socket.remoteAddress !== undefined, true); 17 socket.end(); 18 })); 19 20 socket.on('end', common.mustCall(function() { 21 server.close(); 22 })); 23})); 24