OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // | 4 // |
5 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 | 9 |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 66 matching lines...) Loading... |
77 // Wait for both server and client to see the connections as closed. | 77 // Wait for both server and client to see the connections as closed. |
78 if (closed == connections * 2) { | 78 if (closed == connections * 2) { |
79 Expect.equals(0, server.connectionsInfo().active); | 79 Expect.equals(0, server.connectionsInfo().active); |
80 Expect.equals(server.connectionsInfo().total, | 80 Expect.equals(server.connectionsInfo().total, |
81 server.connectionsInfo().idle); | 81 server.connectionsInfo().idle); |
82 server.close(); | 82 server.close(); |
83 } | 83 } |
84 } | 84 } |
85 server.listen((request) { | 85 server.listen((request) { |
86 var timer = new Timer.periodic(const Duration(milliseconds: 20), (_) { | 86 var timer = new Timer.periodic(const Duration(milliseconds: 20), (_) { |
87 request.response.writeBytes(new Uint8List(16 * 1024)); | 87 request.response.add(new Uint8List(16 * 1024)); |
88 }); | 88 }); |
89 request.response.done | 89 request.response.done |
90 .catchError((_) {}) | 90 .catchError((_) {}) |
91 .whenComplete(() { | 91 .whenComplete(() { |
92 check(); | 92 check(); |
93 timer.cancel(); | 93 timer.cancel(); |
94 }); | 94 }); |
95 }); | 95 }); |
96 var client = new HttpClient(); | 96 var client = new HttpClient(); |
97 for (int i = 0; i < connections; i++) { | 97 for (int i = 0; i < connections; i++) { |
(...skipping 12 matching lines...) Loading... |
110 }); | 110 }); |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 void main() { | 114 void main() { |
115 testClientAndServerCloseNoListen(10); | 115 testClientAndServerCloseNoListen(10); |
116 testClientCloseServerListen(10); | 116 testClientCloseServerListen(10); |
117 testClientCloseSendingResponse(10); | 117 testClientCloseSendingResponse(10); |
118 } | 118 } |
119 | 119 |
OLD | NEW |