File tree 1 file changed +13
-17
lines changed
1 file changed +13
-17
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- var common = require ( '../common' ) ;
2
+ const common = require ( '../common' ) ;
3
3
4
4
if ( ! common . hasCrypto ) {
5
5
common . skip ( 'missing crypto' ) ;
6
6
return ;
7
7
}
8
- var tls = require ( 'tls' ) ;
9
8
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' ) ;
12
12
13
- var options = {
13
+ const options = {
14
14
key : fs . readFileSync ( common . fixturesDir + '/keys/agent2-key.pem' ) ,
15
15
cert : fs . readFileSync ( common . fixturesDir + '/keys/agent2-cert.pem' )
16
16
} ;
17
17
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 ) ;
22
19
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 ) ;
25
22
26
- c . on ( 'connect' , function ( ) {
23
+ c . on ( 'connect' , common . mustCall ( function ( ) {
27
24
c . write ( 'blah\nblah\nblah\n' ) ;
28
- } ) ;
25
+ } ) ) ;
29
26
30
- c . on ( 'end' , function ( ) {
27
+ c . on ( 'end' , common . mustCall ( function ( ) {
31
28
server . close ( ) ;
32
- } ) ;
33
-
34
- } ) ;
29
+ } ) ) ;
30
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments