11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst events = require('events'); 61cb0ef41Sopenharmony_ciconst { createServer, connect } = require('net'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cievents.captureRejections = true; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst server = createServer(common.mustCall(async (sock) => { 111cb0ef41Sopenharmony_ci server.close(); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci const _err = new Error('kaboom'); 141cb0ef41Sopenharmony_ci sock.on('error', common.mustCall((err) => { 151cb0ef41Sopenharmony_ci assert.strictEqual(err, _err); 161cb0ef41Sopenharmony_ci })); 171cb0ef41Sopenharmony_ci throw _err; 181cb0ef41Sopenharmony_ci})); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciserver.listen(0, common.mustCall(() => { 211cb0ef41Sopenharmony_ci const sock = connect( 221cb0ef41Sopenharmony_ci server.address().port, 231cb0ef41Sopenharmony_ci server.address().host 241cb0ef41Sopenharmony_ci ); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci sock.on('close', common.mustCall()); 271cb0ef41Sopenharmony_ci})); 28