11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst net = require('net'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst sockets = []; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst server = net.createServer(function(c) { 91cb0ef41Sopenharmony_ci c.on('close', common.mustCall()); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci sockets.push(c); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci if (sockets.length === 2) { 141cb0ef41Sopenharmony_ci assert.strictEqual(server.close(), server); 151cb0ef41Sopenharmony_ci sockets.forEach((c) => c.resetAndDestroy()); 161cb0ef41Sopenharmony_ci } 171cb0ef41Sopenharmony_ci}); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciserver.on('close', common.mustCall()); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ciassert.strictEqual(server, server.listen(0, () => { 221cb0ef41Sopenharmony_ci net.createConnection(server.address().port) 231cb0ef41Sopenharmony_ci .on('error', common.mustCall((error) => { 241cb0ef41Sopenharmony_ci assert.strictEqual(error.code, 'ECONNRESET'); 251cb0ef41Sopenharmony_ci })); 261cb0ef41Sopenharmony_ci net.createConnection(server.address().port) 271cb0ef41Sopenharmony_ci .on('error', common.mustCall((error) => { 281cb0ef41Sopenharmony_ci assert.strictEqual(error.code, 'ECONNRESET'); 291cb0ef41Sopenharmony_ci })); 301cb0ef41Sopenharmony_ci})); 31