• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// This is based on test-tls-securepair-fiftharg.js
4// for the deprecated `tls.createSecurePair()` variant.
5
6const common = require('../common');
7if (!common.hasCrypto)
8  common.skip('missing crypto');
9
10const assert = require('assert');
11const tls = require('tls');
12const fixtures = require('../common/fixtures');
13const makeDuplexPair = require('../common/duplexpair');
14
15const { clientSide, serverSide } = makeDuplexPair();
16new tls.TLSSocket(serverSide, {
17  isServer: true,
18  SNICallback: common.mustCall((servername, cb) => {
19    assert.strictEqual(servername, 'www.google.com');
20  })
21});
22
23// Captured traffic from browser's request to https://www.google.com
24const sslHello = fixtures.readSync('google_ssl_hello.bin');
25
26clientSide.write(sslHello);
27