|
1 | 1 | 'use strict'; |
2 | | -varcommon=require('../common'); |
3 | | -varassert=require('assert'); |
| 2 | +constcommon=require('../common'); |
4 | 3 |
|
5 | 4 | if(!common.hasCrypto){ |
6 | 5 | common.skip('missing crypto'); |
7 | 6 | return; |
8 | 7 | } |
9 | | -vartls=require('tls'); |
| 8 | +constassert=require('assert'); |
| 9 | +consttls=require('tls'); |
10 | 10 |
|
11 | | -varfs=require('fs'); |
12 | | -varcipher_list=['AES128-SHA256','AES256-SHA256']; |
13 | | -varcipher_version_pattern=/TLS|SSL/; |
14 | | -varoptions={ |
| 11 | +constfs=require('fs'); |
| 12 | +constcipher_list=['AES128-SHA256','AES256-SHA256']; |
| 13 | +constcipher_version_pattern=/TLS|SSL/; |
| 14 | +constoptions={ |
15 | 15 | key: fs.readFileSync(common.fixturesDir+'/keys/agent2-key.pem'), |
16 | 16 | cert: fs.readFileSync(common.fixturesDir+'/keys/agent2-cert.pem'), |
17 | 17 | ciphers: cipher_list.join(':'), |
18 | 18 | honorCipherOrder: true |
19 | 19 | }; |
20 | 20 |
|
21 | | -varserver=tls.createServer(options, |
22 | | -common.mustCall(function(cleartextStream){})); |
| 21 | +constserver=tls.createServer(options, |
| 22 | +common.mustCall(function(cleartextStream){})); |
23 | 23 |
|
24 | | -server.listen(0,'127.0.0.1',function(){ |
25 | | -varclient=tls.connect({ |
| 24 | +server.listen(0,'127.0.0.1',common.mustCall(function(){ |
| 25 | +constclient=tls.connect({ |
26 | 26 | host: '127.0.0.1', |
27 | 27 | port: this.address().port, |
28 | 28 | ciphers: cipher_list.join(':'), |
29 | 29 | rejectUnauthorized: false |
30 | | -},function(){ |
31 | | -varcipher=client.getCipher(); |
32 | | -assert.equal(cipher.name,cipher_list[0]); |
| 30 | +},common.mustCall(function(){ |
| 31 | +constcipher=client.getCipher(); |
| 32 | +assert.strictEqual(cipher.name,cipher_list[0]); |
33 | 33 | assert(cipher_version_pattern.test(cipher.version)); |
34 | 34 | client.end(); |
35 | 35 | server.close(); |
36 | | -}); |
37 | | -}); |
| 36 | +})); |
| 37 | +})); |
0 commit comments