summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-server-unconsume-consume.js
blob: 0135205eb14ed9de3f87fe3aeb837854a090d875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
const common = require('../common');
const http = require('http');

const testServer = http.createServer(common.mustNotCall());
testServer.on('connect', common.mustCall((req, socket, head) => {
  socket.write('HTTP/1.1 200 Connection Established\r\n' +
      'Proxy-agent: Node-Proxy\r\n' +
      '\r\n');
  // This shouldn't raise an assertion in StreamBase::Consume.
  testServer.emit('connection', socket);
  testServer.close();
}));
testServer.listen(0, common.mustCall(() => {
  http.request({
    port: testServer.address().port,
    method: 'CONNECT'
  }, (res) => {}).end();
}));