Skip to content

Commit

Permalink
test: add regression test for nodejs#25735
Browse files Browse the repository at this point in the history
See: nodejs/node-v0.x-archive#25736

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: nodejs/node-v0.x-archive#25739
  • Loading branch information
indutny committed Jul 20, 2015
1 parent 7569711 commit 2299773
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/simple/test-tls-new-session-hang.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var common = require('../common');

if (!process.features.tls_ocsp) {
console.error('Skipping because node compiled without OpenSSL or ' +
'with old OpenSSL version.');
process.exit(0);
}

var assert = require('assert');
var tls = require('tls');
var constants = require('constants');
var fs = require('fs');
var join = require('path').join;

var keyFile = join(common.fixturesDir, 'keys', 'agent1-key.pem');
var certFile = join(common.fixturesDir, 'keys', 'agent1-cert.pem');
var caFile = join(common.fixturesDir, 'keys', 'ca1-cert.pem');
var key = fs.readFileSync(keyFile);
var cert = fs.readFileSync(certFile);

var server = tls.createServer({
cert: cert,
key: key
}, function (socket) {
socket.destroySoon();
});

// Should not be actually called
server.on('resumeSession', function (id, callback) {
assert(false);
});

server.listen(common.PORT, function() {
var client = tls.connect({
rejectUnauthorized: false,
port: common.PORT,

// Just to make sure that `newSession` is going to be called
secureOptions: constants.SSL_OP_NO_TICKET
}, function() {
server.close();
});
});

0 comments on commit 2299773

Please sign in to comment.