@@ -13,16 +13,16 @@ const options = {
13
13
14
14
const connections = { } ;
15
15
16
- const server = https . createServer ( options , function ( req , res ) {
17
- const interval = setInterval ( function ( ) {
16
+ const server = https . createServer ( options , ( req , res ) => {
17
+ const interval = setInterval ( ( ) => {
18
18
res . write ( 'data' ) ;
19
19
} , 1000 ) ;
20
20
interval . unref ( ) ;
21
21
} ) ;
22
22
23
- server . on ( 'connection' , function ( connection ) {
23
+ server . on ( 'connection' , ( connection ) => {
24
24
const key = `${ connection . remoteAddress } :${ connection . remotePort } ` ;
25
- connection . on ( 'close' , function ( ) {
25
+ connection . on ( 'close' , ( ) => {
26
26
delete connections [ key ] ;
27
27
} ) ;
28
28
connections [ key ] = connection ;
@@ -37,16 +37,16 @@ function shutdown() {
37
37
}
38
38
}
39
39
40
- server . listen ( 0 , function ( ) {
40
+ server . listen ( 0 , ( ) => {
41
41
const requestOptions = {
42
42
hostname : '127.0.0.1' ,
43
- port : this . address ( ) . port ,
43
+ port : server . address ( ) . port ,
44
44
path : '/' ,
45
45
method : 'GET' ,
46
46
rejectUnauthorized : false
47
47
} ;
48
48
49
- const req = https . request ( requestOptions , function ( res ) {
49
+ const req = https . request ( requestOptions , ( res ) => {
50
50
res . on ( 'data' , ( ) => { } ) ;
51
51
setImmediate ( shutdown ) ;
52
52
} ) ;
0 commit comments