Created
January 31, 2014 22:09
-
-
Save tjfontaine/8744274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var assert = require('assert'); | |
var net = require('net'); | |
var SIZE = 2E6; | |
var BUF = new Buffer(SIZE); | |
var ERRS = 0; | |
var PORT = 4000; | |
BUF.fill(0x62); | |
var errs = []; | |
var srv = net.createServer(function onConnection(conn) { | |
conn.write(BUF); | |
conn.on('error', function (err) { | |
errs.push(err); | |
if (errs.length > 1 && errs[0] === errs[1]) { | |
assert(false, "We should not be emitting the same error twice"); | |
srv.close(); | |
} | |
}); | |
}).listen(PORT, function () { | |
var client = net.connect({ port: PORT }); | |
client.on('connect', function () { | |
client.resume(); | |
client.destroy(); | |
}); | |
}).unref(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment