@@ -34,7 +34,7 @@ const body = 'C'.repeat(N);
34
34
35
35
console . log ( `start server on port ${ common . PORT } ` ) ;
36
36
37
- const server = net . createServer ( function ( connection ) {
37
+ const server = net . createServer ( ( connection ) => {
38
38
connection . write ( body . slice ( 0 , part_N ) ) ;
39
39
connection . write ( body . slice ( part_N , 2 * part_N ) ) ;
40
40
assert . strictEqual ( connection . write ( body . slice ( 2 * part_N , N ) ) , false ) ;
@@ -44,11 +44,11 @@ const server = net.createServer(function(connection) {
44
44
connection . end ( ) ;
45
45
} ) ;
46
46
47
- server . listen ( common . PORT , function ( ) {
47
+ server . listen ( common . PORT , ( ) => {
48
48
let paused = false ;
49
49
const client = net . createConnection ( common . PORT ) ;
50
50
client . setEncoding ( 'ascii' ) ;
51
- client . on ( 'data' , function ( d ) {
51
+ client . on ( 'data' , ( d ) => {
52
52
chars_recved += d . length ;
53
53
console . log ( `got ${ chars_recved } ` ) ;
54
54
if ( ! paused ) {
@@ -57,7 +57,7 @@ server.listen(common.PORT, function() {
57
57
paused = true ;
58
58
console . log ( 'pause' ) ;
59
59
const x = chars_recved ;
60
- setTimeout ( function ( ) {
60
+ setTimeout ( ( ) => {
61
61
assert . strictEqual ( chars_recved , x ) ;
62
62
client . resume ( ) ;
63
63
console . log ( 'resume' ) ;
@@ -66,14 +66,14 @@ server.listen(common.PORT, function() {
66
66
}
67
67
} ) ;
68
68
69
- client . on ( 'end' , function ( ) {
69
+ client . on ( 'end' , ( ) => {
70
70
server . close ( ) ;
71
71
client . end ( ) ;
72
72
} ) ;
73
73
} ) ;
74
74
75
75
76
- process . on ( 'exit' , function ( ) {
76
+ process . on ( 'exit' , ( ) => {
77
77
assert . strictEqual ( chars_recved , N ) ;
78
78
assert . strictEqual ( npauses > 2 , true ) ;
79
79
} ) ;
0 commit comments