mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
706 B
28 lines
706 B
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const assert = require('assert');
|
|
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('streamClosed', common.mustCall((code) => {
|
|
assert.strictEqual(code, 2);
|
|
client.destroy();
|
|
server.close();
|
|
}));
|
|
}));
|
|
|
|
req.rstStream(2);
|
|
}));
|
|
server.listen(0, common.mustCall(() => {
|
|
client = http2.connect(`http://localhost:${server.address().port}`);
|
|
req = client.request();
|
|
req.resume();
|
|
req.on('error', common.mustCall());
|
|
}));
|
|
|