mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 06:31:11 +00:00

This patch uses `return` statement to skip the test instead of using `process.exit` call. PR-URL: https://github.com/nodejs/io.js/pull/2109 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
37 lines
834 B
JavaScript
37 lines
834 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
if (!common.hasCrypto) {
|
|
console.log('1..0 # Skipped: missing crypto');
|
|
return;
|
|
}
|
|
var tls = require('tls');
|
|
|
|
var fs = require('fs');
|
|
|
|
var clientConnected = 0;
|
|
var serverConnected = 0;
|
|
|
|
var options = {
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
};
|
|
|
|
var server = tls.Server(options, function(socket) {
|
|
++serverConnected;
|
|
server.close();
|
|
});
|
|
server.listen(common.PIPE, function() {
|
|
var options = { rejectUnauthorized: false };
|
|
var client = tls.connect(common.PIPE, options, function() {
|
|
++clientConnected;
|
|
client.end();
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(clientConnected, 1);
|
|
assert.equal(serverConnected, 1);
|
|
});
|