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({ 181cb0ef41Sopenharmony_ci port: port, 191cb0ef41Sopenharmony_ci family: 4, 201cb0ef41Sopenharmony_ci localAddress: common.localhostIPv4 211cb0ef41Sopenharmony_ci }, common.localhostIPv4) 221cb0ef41Sopenharmony_ci .once('error', common.mustCall((e) => { 231cb0ef41Sopenharmony_ci assert.strictEqual(e.code, 'ECONNRESET'); 241cb0ef41Sopenharmony_ci assert.strictEqual(e.path, undefined); 251cb0ef41Sopenharmony_ci assert.strictEqual(e.host, undefined); 261cb0ef41Sopenharmony_ci assert.strictEqual(e.port, port); 271cb0ef41Sopenharmony_ci assert.strictEqual(e.localAddress, common.localhostIPv4); 281cb0ef41Sopenharmony_ci server.close(); 291cb0ef41Sopenharmony_ci errored = true; 301cb0ef41Sopenharmony_ci })) 311cb0ef41Sopenharmony_ci .on('close', common.mustCall(() => { 321cb0ef41Sopenharmony_ci assert.strictEqual(errored, true); 331cb0ef41Sopenharmony_ci })); 341cb0ef41Sopenharmony_ci})); 35