blob: e8ba17a76e6c69261898780535f02a8a21bd2a91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
'use strict';
require('../common');
const assert = require('assert');
const net = require('net');
const iter = 10;
const server = net.createServer(function(socket) {
socket.on('readable', function() {
socket.read();
});
socket.on('end', function() {
server.close();
});
});
server.listen(0, function() {
const client = net.connect(this.address().port);
client.on('finish', function() {
assert.strictEqual(client.bufferSize, 0);
});
for (let i = 1; i < iter; i++) {
client.write('a');
assert.strictEqual(client.bufferSize, i);
}
client.end();
});
|