11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciif (!common.hasCrypto) 51cb0ef41Sopenharmony_ci common.skip('missing crypto'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst https = require('https'); 91cb0ef41Sopenharmony_ciconst net = require('net'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst server = net.createServer(function(s) { 121cb0ef41Sopenharmony_ci s.once('data', function() { 131cb0ef41Sopenharmony_ci s.end('I was waiting for you, hello!', function() { 141cb0ef41Sopenharmony_ci s.destroy(); 151cb0ef41Sopenharmony_ci }); 161cb0ef41Sopenharmony_ci }); 171cb0ef41Sopenharmony_ci}); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciserver.listen(0, function() { 201cb0ef41Sopenharmony_ci const req = https.request({ port: this.address().port }); 211cb0ef41Sopenharmony_ci req.end(); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci req.once('error', common.mustCall(function(err) { 241cb0ef41Sopenharmony_ci assert(/wrong version number/.test(err.message)); 251cb0ef41Sopenharmony_ci server.close(); 261cb0ef41Sopenharmony_ci })); 271cb0ef41Sopenharmony_ci}); 28