2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-12-01 17:41:38 +01:00
|
|
|
const common = require('../common');
|
2015-03-04 02:11:21 +01: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-03-04 02:11:21 +01:00
|
|
|
}
|
|
|
|
|
2016-12-01 17:41:38 +01:00
|
|
|
const tls = require('tls');
|
|
|
|
const fs = require('fs');
|
|
|
|
const net = require('net');
|
2010-12-11 11:45:38 +01:00
|
|
|
|
2016-12-01 17:41:38 +01:00
|
|
|
const options = {
|
2010-12-11 11:45:38 +01:00
|
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
|
|
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
|
|
|
|
};
|
|
|
|
|
2016-12-01 17:41:38 +01:00
|
|
|
const server = tls.createServer(options, common.fail);
|
2010-12-11 11:45:38 +01:00
|
|
|
|
2016-12-01 17:41:38 +01:00
|
|
|
server.listen(0, common.mustCall(function() {
|
|
|
|
const c = net.createConnection(this.address().port);
|
2010-12-11 11:45:38 +01:00
|
|
|
|
2016-12-01 17:41:38 +01:00
|
|
|
c.on('connect', common.mustCall(function() {
|
2011-10-05 00:08:18 +02:00
|
|
|
c.write('blah\nblah\nblah\n');
|
2016-12-01 17:41:38 +01:00
|
|
|
}));
|
2010-12-11 11:45:38 +01:00
|
|
|
|
2016-12-01 17:41:38 +01:00
|
|
|
c.on('end', common.mustCall(function() {
|
2010-12-11 11:45:38 +01:00
|
|
|
server.close();
|
2016-12-01 17:41:38 +01:00
|
|
|
}));
|
|
|
|
}));
|