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 | 5 |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "dart:io"; | 7 import "dart:io"; |
8 | 8 |
9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 25 matching lines...) Expand all Loading... |
36 await throws(() => connectFunction('127.0.0.1', | 36 await throws(() => connectFunction('127.0.0.1', |
37 server.port, | 37 server.port, |
38 sourceAddress: sourceAddress), | 38 sourceAddress: sourceAddress), |
39 (e) => e is ArgumentError); | 39 (e) => e is ArgumentError); |
40 } | 40 } |
41 // Unsupported local address. | 41 // Unsupported local address. |
42 for (sourceAddress in ['8.8.8.8', new InternetAddress('8.8.8.8')]) { | 42 for (sourceAddress in ['8.8.8.8', new InternetAddress('8.8.8.8')]) { |
43 await throws(() => connectFunction('127.0.0.1', | 43 await throws(() => connectFunction('127.0.0.1', |
44 server.port, | 44 server.port, |
45 sourceAddress: sourceAddress), | 45 sourceAddress: sourceAddress), |
46 (e) => e is SocketException); | 46 (e) => e is SocketException && |
| 47 e.address == new InternetAddress('8.8.8.8')); |
47 } | 48 } |
48 // Address family mismatch. | 49 // Address family mismatch. |
49 for (sourceAddress in ['::1', InternetAddress.LOOPBACK_IP_V6]) { | 50 for (sourceAddress in ['::1', InternetAddress.LOOPBACK_IP_V6]) { |
50 await throws(() => connectFunction('127.0.0.1', | 51 await throws(() => connectFunction('127.0.0.1', |
51 server.port, | 52 server.port, |
52 sourceAddress: sourceAddress), | 53 sourceAddress: sourceAddress), |
53 (e) => e is SocketException); | 54 (e) => e is SocketException); |
54 } | 55 } |
55 asyncEnd(); | 56 asyncEnd(); |
56 server.close(); | 57 server.close(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 InternetAddress.ANY_IP_V4, false, Socket.connect, (s) => s.destroy()); | 139 InternetAddress.ANY_IP_V4, false, Socket.connect, (s) => s.destroy()); |
139 testConnect( | 140 testConnect( |
140 InternetAddress.ANY_IP_V6, false, RawSocket.connect, (s) => s.close()); | 141 InternetAddress.ANY_IP_V6, false, RawSocket.connect, (s) => s.close()); |
141 testConnect( | 142 testConnect( |
142 InternetAddress.ANY_IP_V6, false, Socket.connect, (s) => s.destroy()); | 143 InternetAddress.ANY_IP_V6, false, Socket.connect, (s) => s.destroy()); |
143 testConnect( | 144 testConnect( |
144 InternetAddress.ANY_IP_V6, true, RawSocket.connect, (s) => s.close()); | 145 InternetAddress.ANY_IP_V6, true, RawSocket.connect, (s) => s.close()); |
145 testConnect( | 146 testConnect( |
146 InternetAddress.ANY_IP_V6, true, Socket.connect, (s) => s.destroy()); | 147 InternetAddress.ANY_IP_V6, true, Socket.connect, (s) => s.destroy()); |
147 } | 148 } |
OLD | NEW |