1'use strict'; 2const common = require('../common'); 3const http = require('http'); 4 5const testServer = http.createServer(common.mustNotCall()); 6testServer.on('connect', common.mustCall((req, socket, head) => { 7 socket.write('HTTP/1.1 200 Connection Established\r\n' + 8 'Proxy-agent: Node-Proxy\r\n' + 9 '\r\n'); 10 // This shouldn't raise an assertion in StreamBase::Consume. 11 testServer.emit('connection', socket); 12 testServer.close(); 13})); 14testServer.listen(0, common.mustCall(() => { 15 http.request({ 16 port: testServer.address().port, 17 method: 'CONNECT' 18 }, (res) => {}).end(); 19})); 20