mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
8508edbf32
PR-URL: https://github.com/nodejs/node/pull/27867 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
28 lines
598 B
JavaScript
28 lines
598 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const events = require('events');
|
|
const { createServer, connect } = require('net');
|
|
|
|
events.captureRejections = true;
|
|
|
|
const server = createServer(common.mustCall(async (sock) => {
|
|
server.close();
|
|
|
|
const _err = new Error('kaboom');
|
|
sock.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err, _err);
|
|
}));
|
|
throw _err;
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const sock = connect(
|
|
server.address().port,
|
|
server.address().host
|
|
);
|
|
|
|
sock.on('close', common.mustCall());
|
|
}));
|