xref: /third_party/node/test/parallel/test-http2-client-port-80.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciif (!common.hasCrypto)
51cb0ef41Sopenharmony_ci  common.skip('missing crypto');
61cb0ef41Sopenharmony_ciconst assert = require('assert');
71cb0ef41Sopenharmony_ciconst http2 = require('http2');
81cb0ef41Sopenharmony_ciconst net = require('net');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci// Verifies that port 80 gets set as expected
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst connect = net.connect;
131cb0ef41Sopenharmony_cinet.connect = common.mustCall((...args) => {
141cb0ef41Sopenharmony_ci  assert.strictEqual(args[0].port, '80');
151cb0ef41Sopenharmony_ci  return connect(...args);
161cb0ef41Sopenharmony_ci});
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciconst client = http2.connect('http://localhost:80');
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci// A socket error may or may not occur depending on whether there is something
211cb0ef41Sopenharmony_ci// currently listening on port 80. Keep this as a non-op and not a mustCall or
221cb0ef41Sopenharmony_ci// mustNotCall.
231cb0ef41Sopenharmony_ciclient.on('error', () => {});
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciclient.close();
26

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