mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
a7c25b7d42
PR-URL: https://github.com/nodejs/node/pull/19836 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
30 lines
684 B
JavaScript
30 lines
684 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const http2 = require('http2');
|
|
|
|
let client;
|
|
let req;
|
|
const server = http2.createServer();
|
|
server.on('stream', common.mustCall((stream) => {
|
|
stream.on('error', common.mustCall(() => {
|
|
stream.on('close', common.mustCall(() => {
|
|
server.close();
|
|
}));
|
|
}));
|
|
|
|
req.close(2);
|
|
}));
|
|
server.listen(0, common.mustCall(() => {
|
|
client = http2.connect(`http://localhost:${server.address().port}`);
|
|
req = client.request();
|
|
req.resume();
|
|
req.on('error', common.mustCall(() => {
|
|
req.on('close', common.mustCall(() => {
|
|
client.close();
|
|
}));
|
|
}));
|
|
}));
|