2015-05-15 21:21:06 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-07-18 22:33:42 +02:00
|
|
|
const common = require('../common');
|
2016-12-31 00:38:06 +01:00
|
|
|
const assert = require('assert');
|
2015-05-15 21:21:06 +02:00
|
|
|
|
|
|
|
if (!common.hasCrypto) {
|
2016-05-11 21:34:52 +02:00
|
|
|
common.skip('missing crypto');
|
2015-07-07 17:25:55 +02:00
|
|
|
return;
|
2015-05-15 21:21:06 +02:00
|
|
|
}
|
2016-12-31 00:38:06 +01:00
|
|
|
const tls = require('tls');
|
2015-05-15 21:21:06 +02:00
|
|
|
|
2016-12-31 00:38:06 +01:00
|
|
|
const fs = require('fs');
|
2015-05-15 21:21:06 +02:00
|
|
|
|
2017-01-08 14:19:00 +01:00
|
|
|
const server = tls.createServer({
|
2015-05-15 21:21:06 +02:00
|
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
|
|
}, function(c) {
|
2016-07-15 21:43:24 +02:00
|
|
|
}).listen(0, common.mustCall(function() {
|
2017-02-03 20:54:19 +01:00
|
|
|
const c = tls.connect(this.address().port, common.mustNotCall());
|
2015-05-15 21:21:06 +02:00
|
|
|
|
2016-07-15 21:43:24 +02:00
|
|
|
c.on('error', common.mustCall(function(err) {}));
|
2015-05-15 21:21:06 +02:00
|
|
|
|
2016-07-15 21:43:24 +02:00
|
|
|
c.on('close', common.mustCall(function(err) {
|
|
|
|
assert.ok(err);
|
2015-05-15 21:21:06 +02:00
|
|
|
server.close();
|
2016-07-15 21:43:24 +02:00
|
|
|
}));
|
|
|
|
}));
|