0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-22 07:37:56 +01:00
nodejs/test/internet/test-tls-autoselectfamily-backing-socket.js
Paolo Insogna fddd3ffa59
net: improve network family autoselection handle handling
PR-URL: https://github.com/nodejs/node/pull/48464
Fixes: https://github.com/npm/cli/issues/6409
Fixes: https://github.com/KararTY/dank-twitch-irc/issues/13
Fixes: https://github.com/nodejs/node/issues/47644
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2023-06-27 09:17:16 +00:00

23 lines
648 B
JavaScript

'use strict';
const common = require('../common');
const { addresses: { INET_HOST } } = require('../common/internet');
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const { Socket } = require('net');
const { TLSSocket } = require('tls');
// Test that TLS connecting works with autoSelectFamily when using a backing socket
{
const socket = new Socket();
const secureSocket = new TLSSocket(socket);
secureSocket.on('connect', common.mustCall(() => secureSocket.end()));
socket.connect({ host: INET_HOST, port: 443, servername: INET_HOST });
secureSocket.connect({ host: INET_HOST, port: 443, servername: INET_HOST });
}