1'use strict'; 2 3const common = require('../common'); 4const { addresses: { INET_HOST } } = require('../common/internet'); 5 6if (!common.hasCrypto) { 7 common.skip('missing crypto'); 8} 9 10const { setDefaultAutoSelectFamilyAttemptTimeout } = require('net'); 11const { connect } = require('tls'); 12 13// Some of the windows machines in the CI need more time to establish connection 14setDefaultAutoSelectFamilyAttemptTimeout(common.platformTimeout(common.isWindows ? 1500 : 250)); 15 16// Test that TLS connecting works without autoSelectFamily 17{ 18 const socket = connect({ 19 host: INET_HOST, 20 port: 443, 21 servername: INET_HOST, 22 autoSelectFamily: false, 23 }); 24 25 socket.on('secureConnect', common.mustCall(() => socket.end())); 26} 27 28// Test that TLS connecting works with autoSelectFamily 29{ 30 const socket = connect({ 31 host: INET_HOST, 32 port: 443, 33 servername: INET_HOST, 34 autoSelectFamily: true, 35 }); 36 37 socket.on('secureConnect', common.mustCall(() => socket.end())); 38} 39