mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
eb35968de7
`onselect` is set on the `sniObject_` not on the `Connection` instance. See: https://github.com/joyent/node/pull/25109 PR-URL: https://github.com/nodejs/io.js/pull/1720 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
46 lines
980 B
JavaScript
46 lines
980 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
if (!common.hasCrypto) {
|
|
console.log('1..0 # Skipped: missing crypto');
|
|
return;
|
|
}
|
|
var tls = require('tls');
|
|
var net = require('net');
|
|
|
|
var fs = require('fs');
|
|
|
|
var success = false;
|
|
|
|
function filenamePEM(n) {
|
|
return require('path').join(common.fixturesDir, 'keys', n + '.pem');
|
|
}
|
|
|
|
function loadPEM(n) {
|
|
return fs.readFileSync(filenamePEM(n));
|
|
}
|
|
|
|
var server = net.Server(function(raw) {
|
|
var pair = tls.createSecurePair(null, true, false, false);
|
|
pair.on('error', function() {});
|
|
pair.ssl.setSNICallback(function() {
|
|
raw.destroy();
|
|
server.close();
|
|
success = true;
|
|
});
|
|
require('_tls_legacy').pipe(pair, raw);
|
|
}).listen(common.PORT, function() {
|
|
tls.connect({
|
|
port: common.PORT,
|
|
rejectUnauthorized: false,
|
|
servername: 'server'
|
|
}, function() {
|
|
}).on('error', function() {
|
|
// Just ignore
|
|
});
|
|
});
|
|
process.on('exit', function() {
|
|
assert(success);
|
|
});
|