2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2012-12-03 18:29:01 +01:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
2015-03-04 02:11:21 +01:00
|
|
|
|
|
|
|
if (!common.hasCrypto) {
|
|
|
|
console.log('1..0 # Skipped: missing crypto');
|
|
|
|
process.exit();
|
|
|
|
}
|
2012-12-03 18:29:01 +01:00
|
|
|
var tls = require('tls');
|
2015-03-04 02:11:21 +01:00
|
|
|
|
2012-12-03 18:29:01 +01:00
|
|
|
var fs = require('fs');
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
|
|
};
|
|
|
|
|
|
|
|
var server = tls.createServer(options, function(cleartext) {
|
2015-05-14 04:25:57 +02:00
|
|
|
var s = cleartext.setTimeout(50, function() {
|
2012-12-03 18:29:01 +01:00
|
|
|
cleartext.destroy();
|
|
|
|
server.close();
|
|
|
|
});
|
2015-05-14 04:25:57 +02:00
|
|
|
assert.ok(s instanceof tls.TLSSocket);
|
2012-12-03 18:29:01 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
server.listen(common.PORT, function() {
|
|
|
|
tls.connect({
|
|
|
|
host: '127.0.0.1',
|
|
|
|
port: common.PORT,
|
|
|
|
rejectUnauthorized: false
|
|
|
|
});
|
|
|
|
});
|