1'use strict';
2const common = require('../common');
3const { createServer } = require('http');
4const { connect } = require('net');
5
6// Make sure that calling the semi-private close() handlers manually doesn't
7// cause an error.
8
9const server = createServer(common.mustCall((req, res) => {
10  req.client._events.close.forEach((fn) => { fn.bind(req)(); });
11}));
12
13server.unref();
14
15server.listen(0, common.mustCall(() => {
16  const client = connect(server.address().port);
17
18  const req = [
19    'POST / HTTP/1.1',
20    'Content-Length: 11',
21    '',
22    'hello world',
23  ].join('\r\n');
24
25  client.end(req);
26}));
27