mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
32 lines
930 B
JavaScript
32 lines
930 B
JavaScript
|
'use strict';
|
||
|
const common = require('../common');
|
||
|
const https = require('node:https');
|
||
|
const assert = require('node:assert');
|
||
|
|
||
|
const server = https.createServer();
|
||
|
|
||
|
server.on(
|
||
|
'tlsClientError',
|
||
|
common.mustCall((exception, tlsSocket) => {
|
||
|
assert.strictEqual(exception !== undefined, true);
|
||
|
assert.strictEqual(Object.keys(tlsSocket.address()).length !== 0, true);
|
||
|
assert.strictEqual(tlsSocket.localAddress !== undefined, true);
|
||
|
assert.strictEqual(tlsSocket.localPort !== undefined, true);
|
||
|
assert.strictEqual(tlsSocket.remoteAddress !== undefined, true);
|
||
|
assert.strictEqual(tlsSocket.remoteFamily !== undefined, true);
|
||
|
assert.strictEqual(tlsSocket.remotePort !== undefined, true);
|
||
|
}),
|
||
|
);
|
||
|
|
||
|
server.listen(0, () => {
|
||
|
const req = https.request({
|
||
|
hostname: '127.0.0.1',
|
||
|
port: server.address().port,
|
||
|
});
|
||
|
req.on(
|
||
|
'error',
|
||
|
common.mustCall(() => server.close()),
|
||
|
);
|
||
|
req.end();
|
||
|
});
|