mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

PR-URL: https://github.com/nodejs/node/pull/35086 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
28 lines
624 B
JavaScript
28 lines
624 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const Countdown = require('../common/countdown');
|
|
const http2 = require('http2');
|
|
|
|
const server = http2.createServer();
|
|
|
|
let session;
|
|
|
|
const countdown = new Countdown(2, () => {
|
|
server.close(common.mustSucceed());
|
|
session.destroy();
|
|
});
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const client = http2.connect(`http://localhost:${server.address().port}`);
|
|
client.on('connect', common.mustCall(() => countdown.dec()));
|
|
}));
|
|
|
|
server.on('session', common.mustCall((s) => {
|
|
session = s;
|
|
countdown.dec();
|
|
}));
|