'use strict';const common = require('../common');
const assert = require('assert');const net = require('net');
const invalidPort = -1 >>> 0;
new net.Server().listen(0, function() { const address = this.address(); const key = `${address.family}:${address.address}:0`;
assert.strictEqual(this._connectionKey, key); this.close();});
assert.throws(() => { new net.Server().listen({ port: invalidPort }, common.mustNotCall());}, { code: 'ERR_SOCKET_BAD_PORT', name: 'RangeError'});
assert.throws(() => { new net.Server().listen(invalidPort, common.mustNotCall());}, { code: 'ERR_SOCKET_BAD_PORT', name: 'RangeError'});
assert.throws(() => { new net.Server().listen(invalidPort, '0.0.0.0', common.mustNotCall());}, { code: 'ERR_SOCKET_BAD_PORT', name: 'RangeError'});