• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const https = require('node:https');
4const assert = require('node:assert');
5
6const server = https.createServer();
7
8server.on(
9  'tlsClientError',
10  common.mustCall((exception, tlsSocket) => {
11    assert.strictEqual(exception !== undefined, true);
12    assert.strictEqual(Object.keys(tlsSocket.address()).length !== 0, true);
13    assert.strictEqual(tlsSocket.localAddress !== undefined, true);
14    assert.strictEqual(tlsSocket.localPort !== undefined, true);
15    assert.strictEqual(tlsSocket.remoteAddress !== undefined, true);
16    assert.strictEqual(tlsSocket.remoteFamily !== undefined, true);
17    assert.strictEqual(tlsSocket.remotePort !== undefined, true);
18  }),
19);
20
21server.listen(0, () => {
22  const req = https.request({
23    hostname: '127.0.0.1',
24    port: server.address().port,
25  });
26  req.on(
27    'error',
28    common.mustCall(() => server.close()),
29  );
30  req.end();
31});
32