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 assert = require('assert'); 81cb0ef41Sopenharmony_ciconst net = require('net'); 91cb0ef41Sopenharmony_ciconst tls = require('tls'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst server = net.createServer((c) => { 121cb0ef41Sopenharmony_ci c.end(); 131cb0ef41Sopenharmony_ci}).listen(common.mustCall(() => { 141cb0ef41Sopenharmony_ci const port = server.address().port; 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci let errored = false; 171cb0ef41Sopenharmony_ci tls.connect(port, common.localhostIPv4) 181cb0ef41Sopenharmony_ci .once('error', common.mustCall((e) => { 191cb0ef41Sopenharmony_ci assert.strictEqual(e.code, 'ECONNRESET'); 201cb0ef41Sopenharmony_ci assert.strictEqual(e.path, undefined); 211cb0ef41Sopenharmony_ci assert.strictEqual(e.host, common.localhostIPv4); 221cb0ef41Sopenharmony_ci assert.strictEqual(e.port, port); 231cb0ef41Sopenharmony_ci assert.strictEqual(e.localAddress, undefined); 241cb0ef41Sopenharmony_ci server.close(); 251cb0ef41Sopenharmony_ci errored = true; 261cb0ef41Sopenharmony_ci })) 271cb0ef41Sopenharmony_ci .on('close', common.mustCall(() => { 281cb0ef41Sopenharmony_ci assert.strictEqual(errored, true); 291cb0ef41Sopenharmony_ci })); 301cb0ef41Sopenharmony_ci})); 31