• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6const http2 = require('http2');
7
8{
9  const server = http2.createServer((req, res) => {
10    req.pipe(res);
11  });
12
13  server.listen(0, () => {
14    const url = `http://localhost:${server.address().port}`;
15    const client = http2.connect(url);
16    const req = client.request({ ':method': 'POST' });
17
18    for (let i = 0; i < 4000; i++) {
19      req.write(Buffer.alloc(6));
20    }
21
22    req.on('close', common.mustCall(() => {
23      console.log('(req onclose)');
24      server.close();
25      client.close();
26    }));
27
28    req.once('data', common.mustCall(() => req.destroy()));
29  });
30}
31