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.

32 lines
587 B

'use strict';
require('../common');
const assert = require('assert');
const 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(0, function() {
var client = net.connect(this.address().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();
});