2018-07-10 20:12:23 +00:00
|
|
|
// Flags: --expose-internals
|
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
|
|
|
|
if (!common.hasCrypto)
|
|
|
|
common.skip('missing crypto');
|
|
|
|
|
|
|
|
const { validateSnapshotNodes } = require('../common/heap');
|
|
|
|
const net = require('net');
|
|
|
|
const tls = require('tls');
|
|
|
|
|
2018-07-22 01:12:19 +00:00
|
|
|
validateSnapshotNodes('TLSWrap', []);
|
2018-07-10 20:12:23 +00:00
|
|
|
|
|
|
|
const server = net.createServer(common.mustCall((c) => {
|
|
|
|
c.end();
|
|
|
|
})).listen(0, common.mustCall(() => {
|
|
|
|
const c = tls.connect({ port: server.address().port });
|
|
|
|
|
|
|
|
c.on('error', common.mustCall(() => {
|
|
|
|
server.close();
|
|
|
|
}));
|
|
|
|
c.write('hello');
|
|
|
|
|
2018-07-22 01:12:19 +00:00
|
|
|
validateSnapshotNodes('TLSWrap', [
|
2018-07-10 20:12:23 +00:00
|
|
|
{
|
|
|
|
children: [
|
2018-07-22 01:12:19 +00:00
|
|
|
{ name: 'NodeBIO' },
|
|
|
|
{ name: 'NodeBIO' },
|
|
|
|
// `Node / TLSWrap` (C++) -> `TLSWrap` (JS)
|
2018-07-10 20:12:23 +00:00
|
|
|
{ name: 'TLSWrap' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
}));
|