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 | 9 |
10 import "dart:async"; | 10 import "dart:async"; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 socket.close(); | 190 socket.close(); |
191 server.close(); | 191 server.close(); |
192 asyncEnd(); | 192 asyncEnd(); |
193 }, onDone: () { | 193 }, onDone: () { |
194 Expect.fail("Unexpected pipe completion"); | 194 Expect.fail("Unexpected pipe completion"); |
195 }); | 195 }); |
196 }); | 196 }); |
197 }); | 197 }); |
198 } | 198 } |
199 | 199 |
| 200 void testConnectTimeout() { |
| 201 asyncStart(); |
| 202 Duration timeout = new Duration(milliseconds: 20); |
| 203 Socket.connect("8.8.8.7", 80, timeout: timeout).then((socket) { |
| 204 Expect.fail("Unexpected connection made."); |
| 205 asyncEnd(); |
| 206 }).catchError((e) { |
| 207 Expect.isTrue(e is SocketException); |
| 208 asyncEnd(); |
| 209 }); |
| 210 } |
| 211 |
200 main() { | 212 main() { |
201 testArguments(); | 213 testArguments(); |
202 testSimpleBind(); | 214 testSimpleBind(); |
203 testInvalidBind(); | 215 testInvalidBind(); |
204 testConnectImmediateDestroy(); | 216 testConnectImmediateDestroy(); |
205 testConnectConsumerClose(); | 217 testConnectConsumerClose(); |
206 testConnectConsumerWriteClose(); | 218 testConnectConsumerWriteClose(); |
207 testConnectStreamClose(); | 219 testConnectStreamClose(); |
208 testConnectStreamDataClose(true); | 220 testConnectStreamDataClose(true); |
209 testConnectStreamDataClose(false); | 221 testConnectStreamDataClose(false); |
210 testConnectStreamDataCloseCancel(true); | 222 testConnectStreamDataCloseCancel(true); |
211 testConnectStreamDataCloseCancel(false); | 223 testConnectStreamDataCloseCancel(false); |
| 224 testConnectTimeout(); |
212 } | 225 } |
OLD | NEW |