2011-01-02 09:54:19 +00:00
|
|
|
if (!process.versions.openssl) {
|
2011-10-04 22:08:18 +00:00
|
|
|
console.error('Skipping because node compiled without OpenSSL.');
|
2011-01-02 09:54:19 +00:00
|
|
|
process.exit(0);
|
|
|
|
}
|
|
|
|
|
2010-12-11 10:45:38 +00:00
|
|
|
var common = require('../common');
|
|
|
|
var tls = require('tls');
|
|
|
|
var fs = require('fs');
|
|
|
|
var net = require('net');
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
|
|
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
|
|
|
|
};
|
|
|
|
|
2012-08-29 20:53:00 +00:00
|
|
|
var server = tls.createServer(options, function(s) {
|
2011-10-04 22:08:18 +00:00
|
|
|
s.write('welcome!\n');
|
2010-12-11 10:45:38 +00:00
|
|
|
s.pipe(s);
|
|
|
|
});
|
|
|
|
|
2011-10-04 22:08:18 +00:00
|
|
|
server.listen(common.PORT, function() {
|
2010-12-11 10:45:38 +00:00
|
|
|
var c = net.createConnection(common.PORT);
|
|
|
|
|
2011-10-04 22:08:18 +00:00
|
|
|
c.on('connect', function() {
|
|
|
|
c.write('blah\nblah\nblah\n');
|
2010-12-11 10:45:38 +00:00
|
|
|
});
|
|
|
|
|
2011-10-04 22:08:18 +00:00
|
|
|
c.on('end', function() {
|
2010-12-11 10:45:38 +00:00
|
|
|
server.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|