1'use strict'; 2const common = require('../common'); 3const net = require('net'); 4 5function check(addressType) { 6 const server = net.createServer(function(client) { 7 client.end(); 8 server.close(); 9 }); 10 11 const address = addressType === 4 ? '127.0.0.1' : '::1'; 12 server.listen(0, address, function() { 13 net.connect(this.address().port, address) 14 .on('lookup', common.mustNotCall()); 15 }); 16} 17 18check(4); 19common.hasIPv6 && check(6); 20