1'use strict'; 2 3const common = require('../common'); 4const net = require('net'); 5const http = require('http'); 6const assert = require('assert'); 7 8const str = 'GET / HTTP/1.1\r\n' + 9 'Content-Length:'; 10 11 12const server = http.createServer(common.mustNotCall()); 13server.on('clientError', common.mustCall((err, socket) => { 14 assert(/^Parse Error/.test(err.message)); 15 assert.strictEqual(err.code, 'HPE_INVALID_EOF_STATE'); 16 socket.destroy(); 17}, 1)); 18server.listen(0, () => { 19 const client = net.connect({ port: server.address().port }, () => { 20 client.on('data', common.mustNotCall()); 21 client.on('end', common.mustCall(() => { 22 server.close(); 23 })); 24 client.write(str); 25 client.end(); 26 }); 27}); 28