• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const http = require('http');
5
6const agent = new http.Agent();
7const _err = new Error('kaboom');
8agent.createSocket = function(req, options, cb) {
9  cb(_err);
10};
11
12const req = http
13  .request({
14    agent
15  })
16  .on('error', common.mustCall((err) => {
17    assert.strictEqual(err, _err);
18  }))
19  .on('close', common.mustCall(() => {
20    assert.strictEqual(req.destroyed, true);
21  }));
22