test: clean up tls junk test
PR-URL: https://github.com/nodejs/node/pull/9940 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
858c4f7fec
commit
244dd5b589
@ -1,34 +1,30 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var tls = require('tls');
|
|
||||||
|
|
||||||
var fs = require('fs');
|
const tls = require('tls');
|
||||||
var net = require('net');
|
const fs = require('fs');
|
||||||
|
const net = require('net');
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
|
||||||
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = tls.createServer(options, function(s) {
|
const server = tls.createServer(options, common.fail);
|
||||||
s.write('welcome!\n');
|
|
||||||
s.pipe(s);
|
|
||||||
});
|
|
||||||
|
|
||||||
server.listen(0, function() {
|
server.listen(0, common.mustCall(function() {
|
||||||
var c = net.createConnection(this.address().port);
|
const c = net.createConnection(this.address().port);
|
||||||
|
|
||||||
c.on('connect', function() {
|
c.on('connect', common.mustCall(function() {
|
||||||
c.write('blah\nblah\nblah\n');
|
c.write('blah\nblah\nblah\n');
|
||||||
});
|
}));
|
||||||
|
|
||||||
c.on('end', function() {
|
c.on('end', common.mustCall(function() {
|
||||||
server.close();
|
server.close();
|
||||||
});
|
}));
|
||||||
|
}));
|
||||||
});
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user