2 const common = require('../common');
3 const assert = require('assert');
4 const net = require('net');
6 const buf = new Buffer(10 * 1024 * 1024);
15 if (clientSocket && serverSocket) {
16 clientSocket.destroy();
17 serverSocket.write(buf);
21 var srv = net.createServer(function onConnection(conn) {
22 conn.on('error', function(err) {
24 if (errs.length > 1 && errs[0] === errs[1])
25 assert(false, 'We should not be emitting the same error twice');
27 conn.on('close', function() {
32 }).listen(common.PORT, function() {
33 var client = net.connect({ port: common.PORT });
35 client.on('connect', function() {
36 clientSocket = client;
41 process.on('exit', function() {
43 assert.equal(errs.length, 1);