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 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 // OtherResources=certificates/server_chain.pem | 9 // OtherResources=certificates/server_chain.pem |
10 // OtherResources=certificates/server_key.pem | 10 // OtherResources=certificates/server_key.pem |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 String msg = "Unexpected error $e"; | 73 String msg = "Unexpected error $e"; |
74 if (trace != null) msg += "\nStackTrace: $trace"; | 74 if (trace != null) msg += "\nStackTrace: $trace"; |
75 Expect.fail(msg); | 75 Expect.fail(msg); |
76 completer.complete(null); | 76 completer.complete(null); |
77 }); | 77 }); |
78 }); | 78 }); |
79 }); | 79 }); |
80 return completer.future; | 80 return completer.future; |
81 } | 81 } |
82 | 82 |
| 83 void testConnectTimeout() { |
| 84 asyncStart(); |
| 85 Duration timeout = new Duration(milliseconds: 20); |
| 86 SecureSocket.connect("8.8.8.7", 80, timeout: timeout).then((socket) { |
| 87 Expect.fail("Unexpected connection made."); |
| 88 asyncEnd(); |
| 89 }).catchError((e) { |
| 90 Expect.isTrue(e is SocketException); |
| 91 asyncEnd(); |
| 92 }); |
| 93 } |
| 94 |
83 main() async { | 95 main() async { |
84 asyncStart(); | 96 asyncStart(); |
85 await test('pem', 'dartdart'); | 97 await test('pem', 'dartdart'); |
86 await test('p12', 'dartdart'); | 98 await test('p12', 'dartdart'); |
| 99 testConnectTimeout(); |
87 asyncEnd(); | 100 asyncEnd(); |
88 } | 101 } |
OLD | NEW |