mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
465 B
20 lines
465 B
8 years ago
|
'use strict';
|
||
|
const common = require('../common');
|
||
|
const http = require('http');
|
||
|
const net = require('net');
|
||
|
|
||
|
const server = http.createServer(common.fail);
|
||
|
|
||
|
server.listen(0, common.mustCall(() => {
|
||
|
const req = http.get({
|
||
|
createConnection(options, oncreate) {
|
||
|
const socket = net.createConnection(options, oncreate);
|
||
|
socket.once('close', () => server.close());
|
||
|
return socket;
|
||
|
},
|
||
|
port: server.address().port
|
||
|
});
|
||
|
|
||
|
req.abort();
|
||
|
}));
|