11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (!common.hasCrypto) 51cb0ef41Sopenharmony_ci common.skip('missing crypto'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst https = require('https'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciif (process.argv[2] === 'localhost') { 101cb0ef41Sopenharmony_ci const request = https.get('https://localhost:' + process.argv[3]); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci request.on('socket', (socket) => { 131cb0ef41Sopenharmony_ci socket.unref(); 141cb0ef41Sopenharmony_ci }); 151cb0ef41Sopenharmony_ci} else { 161cb0ef41Sopenharmony_ci const assert = require('assert'); 171cb0ef41Sopenharmony_ci const net = require('net'); 181cb0ef41Sopenharmony_ci const server = net.createServer(); 191cb0ef41Sopenharmony_ci server.listen(0); 201cb0ef41Sopenharmony_ci server.on('listening', () => { 211cb0ef41Sopenharmony_ci const port = server.address().port; 221cb0ef41Sopenharmony_ci const { fork } = require('child_process'); 231cb0ef41Sopenharmony_ci const child = fork(__filename, ['localhost', port], {}); 241cb0ef41Sopenharmony_ci child.on('close', (exit_code) => { 251cb0ef41Sopenharmony_ci server.close(); 261cb0ef41Sopenharmony_ci assert.strictEqual(exit_code, 0); 271cb0ef41Sopenharmony_ci }); 281cb0ef41Sopenharmony_ci }); 291cb0ef41Sopenharmony_ci} 30