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

Side by Side Diff: tests/standalone/io/http_server_early_server_close_test.dart

Issue 36643002: Don't close existing connection on HttpServer close (and stream cancel). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix 'disable keep-alive' on server close. Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/http_detach_socket_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 import "package:expect/expect.dart";
6 import "dart:async";
7 import "dart:io";
8 import "dart:isolate";
9
10 class Server {
11 static Future<int> start() {
12 return HttpServer.bind("127.0.0.1", 0).then((server) {
13 server.listen((HttpRequest request) {
14 Timer.run(server.close);
15 }, onError: (e) {
16 String msg = "No server errors expected: $e";
17 var trace = getAttachedStackTrace(e);
18 if (trace != null) msg += "\nStackTrace: $trace";
19 Expect.fail(msg);
20 });
21 return server.port;
22 });
23 }
24 }
25
26 class Client {
27 Client(int port) {
28 ReceivePort r = new ReceivePort();
29 HttpClient client = new HttpClient();
30 client.get("127.0.0.1", port, "/")
31 .then((HttpClientRequest request) {
32 return request.close();
33 })
34 .then((HttpClientResponse response) {
35 Expect.fail(
36 "Response should not be given, as not data was returned.");
37 })
38 .catchError((e) {
39 r.close();
40 });
41 }
42 }
43
44 main() {
45 Server.start().then((port) {
46 new Client(port);
47 });
48 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_detach_socket_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698