()
| 63 | } |
| 64 | |
| 65 | function second() { |
| 66 | // Request second, use the same socket |
| 67 | const req = get('/second', common.mustCall((res) => { |
| 68 | assert.strictEqual(req.reusedSocket, true); |
| 69 | assert.strictEqual(res.statusCode, 200); |
| 70 | res.on('data', checkDataAndSockets); |
| 71 | res.on('end', common.mustCall(() => { |
| 72 | assert.strictEqual(agent.sockets[name].length, 1); |
| 73 | assert.strictEqual(agent.freeSockets[name], undefined); |
| 74 | process.nextTick(common.mustCall(() => { |
| 75 | assert.strictEqual(agent.sockets[name], undefined); |
| 76 | assert.strictEqual(agent.freeSockets[name].length, 1); |
| 77 | assert.strictEqual(agent.totalSocketCount, 1); |
| 78 | remoteClose(); |
| 79 | })); |
| 80 | })); |
| 81 | })); |
| 82 | } |
| 83 | |
| 84 | function remoteClose() { |
| 85 | // Mock remote server close the socket |
no test coverage detected