1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6 7const assert = require('assert'); 8const net = require('net'); 9const tls = require('tls'); 10 11const server = net.createServer((c) => { 12 c.end(); 13}).listen(common.mustCall(() => { 14 const port = server.address().port; 15 16 tls.connect({ 17 port: port, 18 localAddress: common.localhostIPv4 19 }, common.localhostIPv4) 20 .once('error', common.mustCall((e) => { 21 assert.strictEqual(e.code, 'ECONNRESET'); 22 assert.strictEqual(e.path, undefined); 23 assert.strictEqual(e.host, undefined); 24 assert.strictEqual(e.port, port); 25 assert.strictEqual(e.localAddress, common.localhostIPv4); 26 server.close(); 27 })); 28})); 29