• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const http = require('http');
5
6const server = http.createServer(common.mustNotCall());
7
8const keepAliveAgent = new http.Agent({ keepAlive: true });
9
10server.listen(0, common.mustCall(() => {
11  const req = http.get({
12    port: server.address().port,
13    agent: keepAliveAgent
14  });
15
16  req
17    .on('socket', common.mustNotCall())
18    .on('response', common.mustNotCall())
19    .on('close', common.mustCall(() => {
20      assert.strictEqual(req.destroyed, true);
21      server.close();
22      keepAliveAgent.destroy();
23    }))
24    .abort();
25}));
26