Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: tests/standalone/src/io/HttpServerEarlyCloseTest.dart

Issue 9700012: Close connections on server.close(), and call onError on early connection close. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/HttpServerEarlyCloseTest.dart
===================================================================
--- tests/standalone/src/io/HttpServerEarlyCloseTest.dart (revision 0)
+++ tests/standalone/src/io/HttpServerEarlyCloseTest.dart (revision 0)
@@ -0,0 +1,39 @@
+#import("dart:io");
+#import("dart:isolate");
+
+class Server {
+ Server() {
+ HttpServer server = new HttpServer();
+ server.listen("127.0.0.1", 0);
+ port = server.port;
+ server.onRequest = (HttpRequest request, HttpResponse response) {
+ new Timer(100, (timer) => server.close());
+ };
+ server.onError = (Object exception) {
+ Expect.fail("Close should not give an error.");
+ };
+ }
+ int port;
+}
+
+class Client {
+ Client(int port) {
+ ReceivePort r = new ReceivePort();
+ HttpClient client = new HttpClient();
+ HttpClientConnection c = client.get("127.0.0.1", port, "/");
+ c.onRequest = (HttpClientRequest request) {
+ request.outputStream.close();
+ };
+ c.onResponse = (HttpClientResponse response) {
+ Expect.fail("Response should not be given, as not data was returned.");
+ };
+ c.onError = (Object exception) {
+ r.close();
+ };
+ }
+}
+
+main() {
+ Server server = new Server();
+ new Client(server.port);
+}
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698