Index: tests/standalone/io/http_connection_close_test.dart |
diff --git a/tests/standalone/io/http_connection_close_test.dart b/tests/standalone/io/http_connection_close_test.dart |
index 7bc03838462c94a00be55b6985620aba5d4f70d4..c3147f5788b91573f105e00ccdf9d2fc53771a86 100644 |
--- a/tests/standalone/io/http_connection_close_test.dart |
+++ b/tests/standalone/io/http_connection_close_test.dart |
@@ -51,11 +51,15 @@ void testHttp11Close(bool closeRequest) { |
void testStreamResponse() { |
HttpServer.bind().then((server) { |
server.listen((request) { |
- // TODO(ajohnsen): Use timer (see old version). |
- for (int i = 0; i < 10; i++) { |
+ var timer = new Timer.repeating(const Duration(milliseconds: 0), (_) { |
request.response.write( |
'data:${new DateTime.now().millisecondsSinceEpoch}\n\n'); |
- } |
+ }); |
+ request.response.done |
+ .whenComplete(() { |
+ timer.cancel(); |
+ }) |
+ .catchError((_) {}); |
}); |
var client = new HttpClient(); |