• 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');
8
9
10const server = http2.createServer();
11server.on('stream', common.mustCall((stream) => {
12  stream.respond();
13  stream.end();
14}));
15
16server.listen(0, common.mustCall(() => {
17  const client = http2.connect(`http://localhost:${server.address().port}`);
18  const req = client.request();
19  client.once('connect', common.mustCall());
20
21  req.on('response', common.mustCall(() => {
22    assert.strictEqual(client.listenerCount('connect'), 0);
23  }));
24  req.on('close', common.mustCall(() => {
25    server.close();
26    client.close();
27  }));
28}));
29