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

The `test/common` module has the capability to identify if any variable is leaked to the global scope and fail the test. So that has to be imported at the beginning. PR-URL: https://github.com/nodejs/node/pull/7786 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
30 lines
696 B
JavaScript
30 lines
696 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
var tls = require('tls');
|
|
|
|
var fs = require('fs');
|
|
|
|
var server = tls.createServer({
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
}, function(c) {
|
|
}).listen(0, common.mustCall(function() {
|
|
var c = tls.connect(this.address().port, function() {
|
|
assert(false, 'should not be called');
|
|
});
|
|
|
|
c.on('error', common.mustCall(function(err) {}));
|
|
|
|
c.on('close', common.mustCall(function(err) {
|
|
assert.ok(err);
|
|
server.close();
|
|
}));
|
|
}));
|