mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 16:01:52 +00:00

Replace booleans with `common.mustCall()`, migrate from `var` to `const`, and apply minor formatting changes. PR-URL: https://github.com/nodejs/node/pull/6756 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
18 lines
395 B
JavaScript
18 lines
395 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const tls = require('tls');
|
|
|
|
const net = require('net');
|
|
|
|
const socket = net.connect(443, 'www.example.org', common.mustCall(() => {
|
|
const secureSocket = tls.connect({socket: socket}, common.mustCall(() => {
|
|
secureSocket.destroy();
|
|
console.log('ok');
|
|
}));
|
|
}));
|