0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-net-socket-reset-twice.js
pupilTong 360cda1926 net: add ability to reset a tcp socket
Fixes: https://github.com/nodejs/node/issues/27428
PR-URL: https://github.com/nodejs/node/pull/43112
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-05-23 15:47:21 +02:00

16 lines
337 B
JavaScript

'use strict';
const common = require('../common');
const net = require('net');
const server = net.createServer();
server.listen(0);
const port = server.address().port;
const conn = net.createConnection(port);
conn.on('error', common.mustCall(() => {
conn.resetAndDestroy();
}));
conn.on('close', common.mustCall());
server.close();