diff --git a/test/internet/test-tls-reuse-host-from-socket.js b/test/parallel/test-tls-reuse-host-from-socket.js similarity index 73% rename from test/internet/test-tls-reuse-host-from-socket.js rename to test/parallel/test-tls-reuse-host-from-socket.js index f7093856c6ab95..1a7705d911b69e 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/parallel/test-tls-reuse-host-from-socket.js @@ -25,13 +25,19 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); -const tls = require('tls'); - const net = require('net'); +const tls = require('tls'); +const fixtures = require('../common/fixtures'); -const socket = net.connect(443, 'www.example.org', common.mustCall(() => { - const secureSocket = tls.connect({ socket }, common.mustCall(() => { - secureSocket.destroy(); - console.log('ok'); +const server = tls.createServer({ + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') +}).listen(0, common.mustCall(() => { + const socket = net.connect(server.address().port, common.mustCall(() => { + const opts = { socket, rejectUnauthorized: false }; + const secureSocket = tls.connect(opts, common.mustCall(() => { + secureSocket.destroy(); + server.close(); + })); })); }));