@@ -13,16 +13,16 @@ const options = {
1313
1414const connections = { } ;
1515
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 ( ( ) => {
1818 res . write ( 'data' ) ;
1919 } , 1000 ) ;
2020 interval . unref ( ) ;
2121} ) ;
2222
23- server . on ( 'connection' , function ( connection ) {
23+ server . on ( 'connection' , ( connection ) => {
2424 const key = `${ connection . remoteAddress } :${ connection . remotePort } ` ;
25- connection . on ( 'close' , function ( ) {
25+ connection . on ( 'close' , ( ) => {
2626 delete connections [ key ] ;
2727 } ) ;
2828 connections [ key ] = connection ;
@@ -37,16 +37,16 @@ function shutdown() {
3737 }
3838}
3939
40- server . listen ( 0 , function ( ) {
40+ server . listen ( 0 , ( ) => {
4141 const requestOptions = {
4242 hostname : '127.0.0.1' ,
43- port : this . address ( ) . port ,
43+ port : server . address ( ) . port ,
4444 path : '/' ,
4545 method : 'GET' ,
4646 rejectUnauthorized : false
4747 } ;
4848
49- const req = https . request ( requestOptions , function ( res ) {
49+ const req = https . request ( requestOptions , ( res ) => {
5050 res . on ( 'data' , ( ) => { } ) ;
5151 setImmediate ( shutdown ) ;
5252 } ) ;
0 commit comments