0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/parallel/test-tls-pfx-gh-5100-regr.js
Dany Shaanan d469321946 tools: add eslint rule prefer-assert-methods
PR-URL: https://github.com/nodejs/node/pull/8622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2016-09-20 16:35:39 -07:00

41 lines
837 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.strictEqual(
c.authorizationError,
null,
'authorizationError must be null'
);
c.end();
})).listen(0, function() {
var client = tls.connect({
port: this.address().port,
pfx: pfx,
passphrase: 'sample',
rejectUnauthorized: false
}, function() {
client.end();
server.close();
});
});