• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6const assert = require('assert');
7const http2 = require('http2');
8const util = require('util');
9
10const server = http2.createServer();
11server.on('stream', common.mustCall((stream) => {
12  assert.strictEqual(stream.aborted, false);
13  const insp = util.inspect(stream);
14  assert.ok(/Http2Stream {/.test(insp));
15  assert.ok(/  state:/.test(insp));
16  assert.ok(/  readableState:/.test(insp));
17  assert.ok(/  writableState:/.test(insp));
18  stream.end('ok');
19}));
20server.listen(0, common.mustCall(() => {
21  const client = http2.connect(`http://localhost:${server.address().port}`);
22  const req = client.request();
23  req.resume();
24  req.on('close', common.mustCall(() => {
25    client.close();
26    server.close();
27  }));
28}));
29