11'use strict' ;
2- var common = require ( '../common' ) ;
3- var assert = require ( 'assert' ) ;
2+ const common = require ( '../common' ) ;
43
54if ( ! common . hasCrypto ) {
65 common . skip ( 'missing crypto' ) ;
76 return ;
87}
9- var tls = require ( 'tls ' ) ;
8+ const assert = require ( 'assert ' ) ;
109
11- var fs = require ( 'fs ' ) ;
10+ const tls = require ( 'tls ' ) ;
1211
13- var dir = common . fixturesDir ;
14- var options = { key : fs . readFileSync ( dir + '/test_key.pem' ) ,
15- cert : fs . readFileSync ( dir + '/test_cert.pem' ) ,
16- ca : [ fs . readFileSync ( dir + '/test_ca.pem' ) ] } ;
12+ const fs = require ( 'fs' ) ;
1713
18- var writes = [
14+ const dir = common . fixturesDir ;
15+ const options = { key : fs . readFileSync ( dir + '/test_key.pem' ) ,
16+ cert : fs . readFileSync ( dir + '/test_cert.pem' ) ,
17+ ca : [ fs . readFileSync ( dir + '/test_ca.pem' ) ] } ;
18+
19+ const writes = [
1920 'some server data' ,
2021 'and a separate packet' ,
2122 'and one more' ,
2223] ;
23- var receivedWrites = 0 ;
24+ let receivedWrites = 0 ;
2425
25- var server = tls . createServer ( options , function ( c ) {
26+ const server = tls . createServer ( options , function ( c ) {
2627 writes . forEach ( function ( str ) {
2728 c . write ( str ) ;
2829 } ) ;
29- } ) . listen ( 0 , function ( ) {
30+ } ) . listen ( 0 , common . mustCall ( function ( ) {
3031 const connectOpts = { rejectUnauthorized : false } ;
31- var c = tls . connect ( this . address ( ) . port , connectOpts , function ( ) {
32+ const c = tls . connect ( this . address ( ) . port , connectOpts , function ( ) {
3233 c . write ( 'some client data' ) ;
3334 c . on ( 'readable' , function ( ) {
34- var data = c . read ( ) ;
35+ let data = c . read ( ) ;
3536 if ( data === null )
3637 return ;
3738
@@ -47,8 +48,9 @@ var server = tls.createServer(options, function(c) {
4748 }
4849 } ) ;
4950 } ) ;
50- } ) ;
51+ } ) ) ;
52+
5153
5254process . on ( 'exit' , function ( ) {
53- assert . equal ( receivedWrites , writes . length ) ;
55+ assert . strictEqual ( receivedWrites , writes . length ) ;
5456} ) ;
0 commit comments