Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0a4fc64

Browse files
dguoFishrock123
authored andcommittedDec 6, 2016
test: clean up tls junk test
PR-URL: #9940 Reviewed-By: James M Snell <[email protected]>
1 parent a3a664a commit 0a4fc64

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed
 
+13-17
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
'use strict';
2-
var common = require('../common');
2+
const common = require('../common');
33

44
if (!common.hasCrypto) {
55
common.skip('missing crypto');
66
return;
77
}
8-
var tls = require('tls');
98

10-
var fs = require('fs');
11-
var net = require('net');
9+
const tls = require('tls');
10+
const fs = require('fs');
11+
const net = require('net');
1212

13-
var options = {
13+
const options = {
1414
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
1515
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
1616
};
1717

18-
var server = tls.createServer(options, function(s) {
19-
s.write('welcome!\n');
20-
s.pipe(s);
21-
});
18+
const server = tls.createServer(options, common.fail);
2219

23-
server.listen(0, function() {
24-
var c = net.createConnection(this.address().port);
20+
server.listen(0, common.mustCall(function() {
21+
const c = net.createConnection(this.address().port);
2522

26-
c.on('connect', function() {
23+
c.on('connect', common.mustCall(function() {
2724
c.write('blah\nblah\nblah\n');
28-
});
25+
}));
2926

30-
c.on('end', function() {
27+
c.on('end', common.mustCall(function() {
3128
server.close();
32-
});
33-
34-
});
29+
}));
30+
}));

0 commit comments

Comments
 (0)
Please sign in to comment.