You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
584 B

var common = require('../common');
var assert = require('assert');
var net = require('net');
var iter = 10;
var server = net.createServer(function(socket) {
socket.on('readable', function() {
socket.read();
});
socket.on('end', function() {
server.close();
});
});
server.listen(common.PORT, function() {
var client = net.connect(common.PORT);
client.on('finish', function() {
assert.strictEqual(client.bufferSize, 0);
});
for (var i = 1; i < iter; i++) {
client.write('a');
assert.strictEqual(client.bufferSize, i);
}
client.end();
});