{"size": 557, "ext": "js", "max_stars_repo_path": "lts/test/parallel/test-http2-server-session-destroy.js", "max_stars_repo_name": "Dexus/node-compiler", "max_stars_repo_stars_event_min_datetime": "2017-01-12T03:58:44.000Z", "max_stars_repo_stars_event_max_datetime": "2017-08-20T23:39:20.000Z", "max_issues_repo_path": "lts/test/parallel/test-http2-server-session-destroy.js", "max_issues_repo_name": "Dexus/node-compiler", "max_issues_repo_issues_event_min_datetime": "2017-08-21T07:38:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-18T21:59:54.000Z", "max_forks_repo_path": "lts/test/parallel/test-http2-server-session-destroy.js", "max_forks_repo_name": "Dexus/node-compiler", "max_forks_repo_forks_event_min_datetime": "2017-08-25T20:20:01.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-08T02:59:03.000Z"}
{"max_stars_count": 1666, "max_issues_count": 95, "max_forks_count": 161, "avg_line_length": 26.5238095238, "max_line_length": 70, "alphanum_fraction": 0.6355475763}
'use strict';

const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');
const h2 = require('http2');

const server = h2.createServer();
server.listen(0, common.localhostIPv4, common.mustCall(() => {
  const afterConnect = common.mustCall((session) => {
    session.request({ ':method': 'POST' }).end(common.mustCall(() => {
      session.destroy();
      server.close();
    }));
  });

  const port = server.address().port;
  const host = common.localhostIPv4;
  h2.connect(`http://${host}:${port}`, afterConnect);
}));
