xref: /third_party/node/test/parallel/test-net-server-drop-connections.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst net = require('net');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_cilet firstSocket;
71cb0ef41Sopenharmony_ciconst server = net.createServer(common.mustCall((socket) => {
81cb0ef41Sopenharmony_ci  firstSocket = socket;
91cb0ef41Sopenharmony_ci}));
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciserver.maxConnections = 1;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciserver.on('drop', common.mustCall((data) => {
141cb0ef41Sopenharmony_ci  assert.strictEqual(!!data.localAddress, true);
151cb0ef41Sopenharmony_ci  assert.strictEqual(!!data.localPort, true);
161cb0ef41Sopenharmony_ci  assert.strictEqual(!!data.remoteAddress, true);
171cb0ef41Sopenharmony_ci  assert.strictEqual(!!data.remotePort, true);
181cb0ef41Sopenharmony_ci  assert.strictEqual(!!data.remoteFamily, true);
191cb0ef41Sopenharmony_ci  firstSocket.destroy();
201cb0ef41Sopenharmony_ci  server.close();
211cb0ef41Sopenharmony_ci}));
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ciserver.listen(0, () => {
241cb0ef41Sopenharmony_ci  net.createConnection(server.address().port);
251cb0ef41Sopenharmony_ci  net.createConnection(server.address().port);
261cb0ef41Sopenharmony_ci});
27

Indexes created Thu Nov 07 10:32:03 CST 2024