(port, callback)
| 42 | }); |
| 43 | |
| 44 | function runClient(port, callback) { |
| 45 | const client = net.createConnection(port); |
| 46 | |
| 47 | client.connections = 0; |
| 48 | |
| 49 | client.setEncoding('utf8'); |
| 50 | |
| 51 | client.on('connect', function() { |
| 52 | console.log('c'); |
| 53 | client.recved = ''; |
| 54 | client.connections += 1; |
| 55 | }); |
| 56 | |
| 57 | client.on('data', function(chunk) { |
| 58 | this.recved += chunk; |
| 59 | }); |
| 60 | |
| 61 | client.on('end', function() { |
| 62 | client.end(); |
| 63 | }); |
| 64 | |
| 65 | client.on('close', common.mustCall(function(had_error) { |
| 66 | assert.strictEqual(had_error, false); |
| 67 | assert.strictEqual(client.recved.length, bytes); |
| 68 | |
| 69 | if (client.fd) { |
| 70 | console.log(client.fd); |
| 71 | } |
| 72 | assert.ok(!client.fd); |
| 73 | |
| 74 | if (this.connections < connections_per_client) { |
| 75 | this.connect(port); |
| 76 | } else { |
| 77 | callback(); |
| 78 | } |
| 79 | }, connections_per_client)); |
| 80 | } |
| 81 | |
| 82 | server.listen(0, function() { |
| 83 | let finished_clients = 0; |
no test coverage detected
searching dependent graphs…