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')); | |
48 } | 47 } |
49 // Address family mismatch. | 48 // Address family mismatch. |
50 for (sourceAddress in ['::1', InternetAddress.LOOPBACK_IP_V6]) { | 49 for (sourceAddress in ['::1', InternetAddress.LOOPBACK_IP_V6]) { |
51 await throws(() => connectFunction('127.0.0.1', | 50 await throws(() => connectFunction('127.0.0.1', |
52 server.port, | 51 server.port, |
53 sourceAddress: sourceAddress), | 52 sourceAddress: sourceAddress), |
54 (e) => e is SocketException); | 53 (e) => e is SocketException); |
55 } | 54 } |
56 asyncEnd(); | 55 asyncEnd(); |
57 server.close(); | 56 server.close(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 InternetAddress.ANY_IP_V4, false, Socket.connect, (s) => s.destroy()); | 138 InternetAddress.ANY_IP_V4, false, Socket.connect, (s) => s.destroy()); |
140 testConnect( | 139 testConnect( |
141 InternetAddress.ANY_IP_V6, false, RawSocket.connect, (s) => s.close()); | 140 InternetAddress.ANY_IP_V6, false, RawSocket.connect, (s) => s.close()); |
142 testConnect( | 141 testConnect( |
143 InternetAddress.ANY_IP_V6, false, Socket.connect, (s) => s.destroy()); | 142 InternetAddress.ANY_IP_V6, false, Socket.connect, (s) => s.destroy()); |
144 testConnect( | 143 testConnect( |
145 InternetAddress.ANY_IP_V6, true, RawSocket.connect, (s) => s.close()); | 144 InternetAddress.ANY_IP_V6, true, RawSocket.connect, (s) => s.close()); |
146 testConnect( | 145 testConnect( |
147 InternetAddress.ANY_IP_V6, true, Socket.connect, (s) => s.destroy()); | 146 InternetAddress.ANY_IP_V6, true, Socket.connect, (s) => s.destroy()); |
148 } | 147 } |
OLD | NEW |