1'use strict'; 2const common = require('../common'); 3const http = require('http'); 4const net = require('net'); 5const server = http.createServer(function(req, res) { 6 res.end(); 7}); 8 9server.listen(0, common.mustCall(function() { 10 const req = http.request({ 11 port: this.address().port 12 }, common.mustCall()); 13 14 req.on('abort', common.mustCall(function() { 15 server.close(); 16 })); 17 18 req.end(); 19 req.abort(); 20 21 req.emit('response', new http.IncomingMessage(new net.Socket())); 22})); 23