2017-01-26 13:58:51 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const http = require('http');
|
|
|
|
|
2017-02-03 14:54:19 -05:00
|
|
|
const testServer = http.createServer(common.mustNotCall());
|
2017-01-26 13:58:51 +02:00
|
|
|
testServer.on('connect', common.mustCall((req, socket, head) => {
|
2017-04-24 01:16:24 +03:00
|
|
|
socket.write('HTTP/1.1 200 Connection Established\r\n' +
|
|
|
|
'Proxy-agent: Node-Proxy\r\n' +
|
2017-01-26 13:58:51 +02:00
|
|
|
'\r\n');
|
|
|
|
// This shouldn't raise an assertion in StreamBase::Consume.
|
|
|
|
testServer.emit('connection', socket);
|
|
|
|
testServer.close();
|
|
|
|
}));
|
|
|
|
testServer.listen(0, common.mustCall(() => {
|
|
|
|
http.request({
|
2017-02-07 12:21:25 -05:00
|
|
|
port: testServer.address().port,
|
|
|
|
method: 'CONNECT'
|
2017-01-26 13:58:51 +02:00
|
|
|
}, (res) => {}).end();
|
|
|
|
}));
|