node/test/internet/test-tls-autoselectfamily-servername.js
Paolo Insogna 8b51c1a869 net: enable autoSelectFamily by default
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>
2023-04-05 08:31:56 -07:00

35 lines
728 B
JavaScript

'use strict';
const common = require('../common');
const { addresses: { INET_HOST } } = require('../common/internet');
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const { connect } = require('tls');
// Test that TLS connecting works without autoSelectFamily
{
const socket = connect({
host: INET_HOST,
port: 443,
servername: INET_HOST,
autoSelectFamily: false,
});
socket.on('secureConnect', common.mustCall(() => socket.end()));
}
// Test that TLS connecting works with autoSelectFamily
{
const socket = connect({
host: INET_HOST,
port: 443,
servername: INET_HOST,
autoSelectFamily: true,
});
socket.on('secureConnect', common.mustCall(() => socket.end()));
}