|
1 | 1 | 'use strict';
|
2 |
| -var common = require('../common'); |
3 |
| -var assert = require('assert'); |
| 2 | +const common = require('../common'); |
4 | 3 |
|
5 | 4 | if (!common.hasCrypto) {
|
6 | 5 | common.skip('missing crypto');
|
7 | 6 | return;
|
8 | 7 | }
|
9 |
| -var tls = require('tls'); |
| 8 | +const assert = require('assert'); |
| 9 | +const tls = require('tls'); |
10 | 10 |
|
11 |
| -var fs = require('fs'); |
12 |
| -var cipher_list = ['AES128-SHA256', 'AES256-SHA256']; |
13 |
| -var cipher_version_pattern = /TLS|SSL/; |
14 |
| -var options = { |
| 11 | +const fs = require('fs'); |
| 12 | +const cipher_list = ['AES128-SHA256', 'AES256-SHA256']; |
| 13 | +const cipher_version_pattern = /TLS|SSL/; |
| 14 | +const options = { |
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 |
| -var server = tls.createServer(options, |
22 |
| - common.mustCall(function(cleartextStream) {})); |
| 21 | +const server = tls.createServer(options, |
| 22 | + common.mustCall(function(cleartextStream) {})); |
23 | 23 |
|
24 |
| -server.listen(0, '127.0.0.1', function() { |
25 |
| - var client = tls.connect({ |
| 24 | +server.listen(0, '127.0.0.1', common.mustCall(function() { |
| 25 | + const client = 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 |
| - var cipher = client.getCipher(); |
32 |
| - assert.equal(cipher.name, cipher_list[0]); |
| 30 | + }, common.mustCall(function() { |
| 31 | + const cipher = 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