@@ -28,44 +28,44 @@ const N = 200;
2828let recv = '' ;
2929let chars_recved = 0 ;
3030
31- const server = net . createServer ( function ( connection ) {
31+ const server = net . createServer ( ( connection ) => {
3232 function write ( j ) {
3333 if ( j >= N ) {
3434 connection . end ( ) ;
3535 return ;
3636 }
37- setTimeout ( function ( ) {
37+ setTimeout ( ( ) => {
3838 connection . write ( 'C' ) ;
3939 write ( j + 1 ) ;
4040 } , 10 ) ;
4141 }
4242 write ( 0 ) ;
4343} ) ;
4444
45- server . on ( 'listening' , function ( ) {
45+ server . on ( 'listening' , ( ) => {
4646 const client = net . createConnection ( common . PORT ) ;
4747 client . setEncoding ( 'ascii' ) ;
4848 client . on ( 'data' , function ( d ) {
4949 console . log ( d ) ;
5050 recv += d ;
5151 } ) ;
5252
53- setTimeout ( function ( ) {
53+ setTimeout ( ( ) => {
5454 chars_recved = recv . length ;
5555 console . log ( `pause at: ${ chars_recved } ` ) ;
5656 assert . strictEqual ( chars_recved > 1 , true ) ;
5757 client . pause ( ) ;
58- setTimeout ( function ( ) {
58+ setTimeout ( ( ) => {
5959 console . log ( `resume at: ${ chars_recved } ` ) ;
6060 assert . strictEqual ( chars_recved , recv . length ) ;
6161 client . resume ( ) ;
6262
63- setTimeout ( function ( ) {
63+ setTimeout ( ( ) => {
6464 chars_recved = recv . length ;
6565 console . log ( `pause at: ${ chars_recved } ` ) ;
6666 client . pause ( ) ;
6767
68- setTimeout ( function ( ) {
68+ setTimeout ( ( ) => {
6969 console . log ( `resume at: ${ chars_recved } ` ) ;
7070 assert . strictEqual ( chars_recved , recv . length ) ;
7171 client . resume ( ) ;
@@ -78,14 +78,14 @@ server.on('listening', function() {
7878
7979 } , 500 ) ;
8080
81- client . on ( 'end' , function ( ) {
81+ client . on ( 'end' , ( ) => {
8282 server . close ( ) ;
8383 client . end ( ) ;
8484 } ) ;
8585} ) ;
8686server . listen ( common . PORT ) ;
8787
88- process . on ( 'exit' , function ( ) {
88+ process . on ( 'exit' , ( ) => {
8989 assert . strictEqual ( recv . length , N ) ;
9090 console . error ( 'Exit' ) ;
9191} ) ;
0 commit comments