mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 23:43:09 +01:00
8b51c1a869
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/46790 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
18 lines
597 B
JavaScript
18 lines
597 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const net = require('net');
|
|
const assert = require('assert');
|
|
|
|
const c = net.createConnection(common.PORT);
|
|
|
|
c.on('connect', common.mustNotCall());
|
|
|
|
c.on('error', common.mustCall(function(error) {
|
|
// Family autoselection might be skipped if only a single address is returned by DNS.
|
|
const failedAttempt = Array.isArray(error.errors) ? error.errors[0] : error;
|
|
|
|
assert.strictEqual(failedAttempt.code, 'ECONNREFUSED');
|
|
assert.strictEqual(failedAttempt.port, common.PORT);
|
|
assert.match(failedAttempt.address, /^(127\.0\.0\.1|::1)$/);
|
|
}));
|