|
@ -27,6 +27,7 @@ var net = require('net'); |
|
|
var N = 50; |
|
|
var N = 50; |
|
|
var c = 0; |
|
|
var c = 0; |
|
|
var client_recv_count = 0; |
|
|
var client_recv_count = 0; |
|
|
|
|
|
var client_end_count = 0; |
|
|
var disconnect_count = 0; |
|
|
var disconnect_count = 0; |
|
|
|
|
|
|
|
|
var server = net.createServer(function(socket) { |
|
|
var server = net.createServer(function(socket) { |
|
@ -67,6 +68,7 @@ server.listen(common.PORT, function() { |
|
|
|
|
|
|
|
|
client.on('end', function() { |
|
|
client.on('end', function() { |
|
|
console.error('CLIENT end'); |
|
|
console.error('CLIENT end'); |
|
|
|
|
|
client_end_count++; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
client.on('close', function(had_error) { |
|
|
client.on('close', function(had_error) { |
|
@ -82,5 +84,6 @@ server.listen(common.PORT, function() { |
|
|
process.on('exit', function() { |
|
|
process.on('exit', function() { |
|
|
assert.equal(N + 1, disconnect_count); |
|
|
assert.equal(N + 1, disconnect_count); |
|
|
assert.equal(N + 1, client_recv_count); |
|
|
assert.equal(N + 1, client_recv_count); |
|
|
|
|
|
assert.equal(N + 1, client_end_count); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|