Index: tests/standalone/io/http_content_length_test.dart |
diff --git a/tests/standalone/io/http_content_length_test.dart b/tests/standalone/io/http_content_length_test.dart |
index 61156827e3a4962b6fc1bbda55a31b49248851d2..d2938e8d86a39696e5670568f0a1d142d89ee538 100644 |
--- a/tests/standalone/io/http_content_length_test.dart |
+++ b/tests/standalone/io/http_content_length_test.dart |
@@ -68,6 +68,7 @@ void testNoBody(int totalConnections, bool explicitContentLength) { |
void testBody(int totalConnections, bool useHeader) { |
HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { |
+ int serverCount = 0; |
server.listen( |
(HttpRequest request) { |
Expect.equals("2", request.headers.value('content-length')); |
@@ -92,6 +93,9 @@ void testBody(int totalConnections, bool useHeader) { |
}) |
.catchError((e) { |
Expect.isTrue(e.error is HttpException, "[$e] [${e.error}]"); |
Søren Gjesse
2013/03/01 11:51:19
Long line (not your fault).
Anders Johnsen
2013/03/01 12:26:54
Done.
|
+ if (++serverCount == totalConnections) { |
+ server.close(); |
+ } |
}); |
response.close(); |
Expect.throws(() => response.addString("x"), |
@@ -100,7 +104,7 @@ void testBody(int totalConnections, bool useHeader) { |
}, |
onError: (e) => Expect.fail("Unexpected error $e")); |
- int count = 0; |
+ int clientCount = 0; |
HttpClient client = new HttpClient(); |
for (int i = 0; i < totalConnections; i++) { |
client.get("127.0.0.1", server.port, "/") |
@@ -123,9 +127,8 @@ void testBody(int totalConnections, bool useHeader) { |
response.listen( |
(d) {}, |
onDone: () { |
- if (++count == totalConnections) { |
+ if (++clientCount == totalConnections) { |
client.close(); |
- server.close(); |
} |
}); |
}); |