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 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 | 7 |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 return request.close(); | 21 return request.close(); |
22 }) | 22 }) |
23 .then((response) { | 23 .then((response) { |
24 response.listen( | 24 response.listen( |
25 (_) {}, | 25 (_) {}, |
26 onDone: () { | 26 onDone: () { |
27 client.close(); | 27 client.close(); |
28 onDone(); | 28 onDone(); |
29 }); | 29 }); |
30 }) | 30 }) |
31 .catchError((e) { | 31 .catchError((e, trace) { |
32 String msg = "Unexpected error in Http Client: $e"; | 32 String msg = "Unexpected error in Http Client: $e"; |
33 var trace = getAttachedStackTrace(e); | |
34 if (trace != null) msg += "\nStackTrace: $trace"; | 33 if (trace != null) msg += "\nStackTrace: $trace"; |
35 Expect.fail(msg); | 34 Expect.fail(msg); |
36 }); | 35 }); |
37 } | 36 } |
38 | 37 |
39 // Test two connection after each other. | 38 // Test two connection after each other. |
40 asyncStart(); | 39 asyncStart(); |
41 ServerSocket.bind("127.0.0.1", 0).then((s) { | 40 ServerSocket.bind("127.0.0.1", 0).then((s) { |
42 socket = s; | 41 socket = s; |
43 server = new HttpServer.listenOn(socket); | 42 server = new HttpServer.listenOn(socket); |
(...skipping 13 matching lines...) Expand all Loading... |
57 socket.close(); | 56 socket.close(); |
58 asyncEnd(); | 57 asyncEnd(); |
59 }); | 58 }); |
60 }); | 59 }); |
61 }); | 60 }); |
62 } | 61 } |
63 | 62 |
64 void main() { | 63 void main() { |
65 testListenOn(); | 64 testListenOn(); |
66 } | 65 } |
OLD | NEW |