MCPcopy Create free account
hub / github.com/nodejs/node / remoteError

Function remoteError

test/parallel/test-http-agent-keepalive.js:109–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109function remoteError() {
110 // Remote server will destroy the socket
111 const req = get('/error', common.mustNotCall());
112 req.on('error', common.mustCall((err) => {
113 assert(err);
114 assert.strictEqual(err.message, 'socket hang up');
115 assert.strictEqual(agent.sockets[name].length, 1);
116 assert.strictEqual(agent.freeSockets[name], undefined);
117 assert.strictEqual(agent.totalSocketCount, 1);
118 // Wait socket 'close' event emit
119 setTimeout(common.mustCall(() => {
120 assert.strictEqual(agent.sockets[name], undefined);
121 assert.strictEqual(agent.freeSockets[name], undefined);
122 assert.strictEqual(agent.totalSocketCount, 0);
123 server.close();
124 }), common.platformTimeout(1));
125 }));
126}
127
128server.listen(0, common.mustCall(() => {
129 name = `localhost:${server.address().port}:`;

Callers 1

remoteCloseFunction · 0.85

Calls 5

getFunction · 0.70
closeMethod · 0.65
assertFunction · 0.50
setTimeoutFunction · 0.50
onMethod · 0.45

Tested by

no test coverage detected