mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
d247a8e1dc
PR-URL: https://github.com/nodejs/node/pull/28685 Refs: https://github.com/nodejs/node/issues/28684 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
24 lines
542 B
JavaScript
24 lines
542 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer(common.mustNotCall());
|
|
|
|
const keepAliveAgent = new http.Agent({ keepAlive: true });
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const req = http.get({
|
|
port: server.address().port,
|
|
agent: keepAliveAgent
|
|
});
|
|
|
|
req
|
|
.on('socket', common.mustNotCall())
|
|
.on('response', common.mustNotCall())
|
|
.on('close', common.mustCall(() => {
|
|
server.close();
|
|
keepAliveAgent.destroy();
|
|
}))
|
|
.abort();
|
|
}));
|