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 exec = require ( 'child_process' ) . exec ;
12
- var fs = require ( 'fs' ) ;
11
+ const exec = require ( 'child_process' ) . exec ;
12
+ const fs = require ( 'fs' ) ;
13
13
14
- var options = {
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 : '-ALL:ECDHE-RSA-AES128-SHA256' ,
18
18
ecdhCurve : 'prime256v1'
19
19
} ;
20
20
21
- var reply = 'I AM THE WALRUS' ; // something recognizable
21
+ const reply = 'I AM THE WALRUS' ; // something recognizable
22
22
23
- var server = tls . createServer ( options , common . mustCall ( function ( conn ) {
23
+ const server = tls . createServer ( options , common . mustCall ( function ( conn ) {
24
24
conn . end ( reply ) ;
25
25
} ) ) ;
26
26
27
27
server . listen ( 0 , '127.0.0.1' , common . mustCall ( function ( ) {
28
- var cmd = '"' + common . opensslCli + '" s_client -cipher ' + options . ciphers +
28
+ let cmd = '"' + common . opensslCli + '" s_client -cipher ' + options . ciphers +
29
29
` -connect 127.0.0.1:${ this . address ( ) . port } ` ;
30
30
31
31
// for the performance and stability issue in s_client on Windows
@@ -34,7 +34,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
34
34
35
35
exec ( cmd , common . mustCall ( function ( err , stdout , stderr ) {
36
36
if ( err ) throw err ;
37
- assert . notEqual ( stdout . indexOf ( reply ) , - 1 ) ;
37
+ assert ( stdout . includes ( reply ) ) ;
38
38
server . close ( ) ;
39
39
} ) ) ;
40
40
} ) ) ;
0 commit comments