xref: /third_party/node/test/parallel/test-tls-socket-snicallback-without-server.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ci// This is based on test-tls-securepair-fiftharg.js
41cb0ef41Sopenharmony_ci// for the deprecated `tls.createSecurePair()` variant.
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst common = require('../common');
71cb0ef41Sopenharmony_ciif (!common.hasCrypto)
81cb0ef41Sopenharmony_ci  common.skip('missing crypto');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst assert = require('assert');
111cb0ef41Sopenharmony_ciconst tls = require('tls');
121cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
131cb0ef41Sopenharmony_ciconst makeDuplexPair = require('../common/duplexpair');
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciconst { clientSide, serverSide } = makeDuplexPair();
161cb0ef41Sopenharmony_cinew tls.TLSSocket(serverSide, {
171cb0ef41Sopenharmony_ci  isServer: true,
181cb0ef41Sopenharmony_ci  SNICallback: common.mustCall((servername, cb) => {
191cb0ef41Sopenharmony_ci    assert.strictEqual(servername, 'www.google.com');
201cb0ef41Sopenharmony_ci  })
211cb0ef41Sopenharmony_ci});
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci// Captured traffic from browser's request to https://www.google.com
241cb0ef41Sopenharmony_ciconst sslHello = fixtures.readSync('google_ssl_hello.bin');
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ciclientSide.write(sslHello);
27

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