• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const http = require('http');
4
5const server = http.createServer(common.mustNotCall());
6
7class Agent extends http.Agent {
8  createConnection(options, oncreate) {
9    const socket = super.createConnection(options, oncreate);
10    socket.once('close', () => server.close());
11    return socket;
12  }
13}
14
15const tmpdir = require('../common/tmpdir');
16tmpdir.refresh();
17
18server.listen(common.PIPE, common.mustCall(() => {
19  const req = http.get({
20    agent: new Agent(),
21    socketPath: common.PIPE
22  });
23
24  req.abort();
25}));
26