node/test/parallel/test-tls-pfx-gh-5100-regr.js
Jeremiah Senkpiel 52bae222a3 test: abstract skip functionality to common
The tap skipping output is so prevalent yet obscure in nature that we
ought to move it into it's own function in test/common.js

PR-URL: https://github.com/nodejs/node/pull/6697
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-05-12 16:43:35 -04:00

37 lines
814 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto) {
common.skip('node compiled without crypto.');
return;
}
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const path = require('path');
const pfx = fs.readFileSync(
path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem'));
const server = tls.createServer({
pfx: pfx,
passphrase: 'sample',
requestCert: true,
rejectUnauthorized: false
}, common.mustCall(function(c) {
assert(c.authorizationError === null, 'authorizationError must be null');
c.end();
})).listen(common.PORT, function() {
var client = tls.connect({
port: common.PORT,
pfx: pfx,
passphrase: 'sample',
rejectUnauthorized: false
}, function() {
client.end();
server.close();
});
});