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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 subscription.cancel(); | 192 subscription.cancel(); |
193 socket.close(); | 193 socket.close(); |
194 server.close(); | 194 server.close(); |
195 asyncEnd(); | 195 asyncEnd(); |
196 }, | 196 }, |
197 onDone: () { Expect.fail("Unexpected pipe completion"); }); | 197 onDone: () { Expect.fail("Unexpected pipe completion"); }); |
198 }); | 198 }); |
199 }); | 199 }); |
200 } | 200 } |
201 | 201 |
| 202 |
| 203 void testConnectMultipleInternetAddress() { |
| 204 // Ip addresses are invalid, if they start with '0'. We use this fact, to |
| 205 // avoid waiting for timeout. |
| 206 asyncStart(); |
| 207 ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) { |
| 208 server.listen( |
| 209 (client) { |
| 210 client.destroy(); |
| 211 server.close(); |
| 212 asyncEnd(); |
| 213 }); |
| 214 var addresses = [new InternetAddress("0.42.42.42"), |
| 215 new InternetAddress("127.0.0.1")]; |
| 216 Socket.connect(addresses, server.port).then((socket) { |
| 217 socket.destroy(); |
| 218 }); |
| 219 }); |
| 220 |
| 221 var addresses = [new InternetAddress("0.42.42.42"), |
| 222 new InternetAddress("0.42.42.43")]; |
| 223 asyncStart(); |
| 224 Socket.connect(addresses, 3213) |
| 225 .catchError((error) { |
| 226 Expect.equals("0.42.42.43", error.address.host); |
| 227 asyncEnd(); |
| 228 }); |
| 229 } |
| 230 |
202 main() { | 231 main() { |
203 testArguments(); | 232 testArguments(); |
204 testSimpleBind(); | 233 testSimpleBind(); |
205 testInvalidBind(); | 234 testInvalidBind(); |
206 testConnectImmediateDestroy(); | 235 testConnectImmediateDestroy(); |
207 testConnectConsumerClose(); | 236 testConnectConsumerClose(); |
208 testConnectConsumerWriteClose(); | 237 testConnectConsumerWriteClose(); |
209 testConnectStreamClose(); | 238 testConnectStreamClose(); |
210 testConnectStreamDataClose(true); | 239 testConnectStreamDataClose(true); |
211 testConnectStreamDataClose(false); | 240 testConnectStreamDataClose(false); |
212 testConnectStreamDataCloseCancel(true); | 241 testConnectStreamDataCloseCancel(true); |
213 testConnectStreamDataCloseCancel(false); | 242 testConnectStreamDataCloseCancel(false); |
| 243 testConnectMultipleInternetAddress(); |
214 } | 244 } |
OLD | NEW |