| 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 | 7 |
| 8 const ANY = InternetAddressType.ANY; | 8 const ANY = InternetAddressType.ANY; |
| 9 | 9 |
| 10 void testIPv6toIPv6() { | 10 void testIPv6toIPv6() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (list.length < 0) throw "no addresse"; | 81 if (list.length < 0) throw "no addresse"; |
| 82 for (var entry in list) { | 82 for (var entry in list) { |
| 83 if (entry.type != InternetAddressType.IP_V4) { | 83 if (entry.type != InternetAddressType.IP_V4) { |
| 84 throw "Wrong IP type"; | 84 throw "Wrong IP type"; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 port.close(); | 87 port.close(); |
| 88 }); | 88 }); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void testIPv4toIPv6_IPV6Only() { |
| 92 InternetAddress.lookup("::0", type: ANY) |
| 93 .then((serverAddr) { |
| 94 ServerSocket.bind(serverAddr.first, 0, v6Only: true) |
| 95 .then((server) { |
| 96 server.listen((socket) { |
| 97 throw "Unexpcted socket"; |
| 98 }); |
| 99 Socket.connect("127.0.0.1", server.port).catchError((error) { |
| 100 server.close(); |
| 101 }); |
| 102 }); |
| 103 }); |
| 104 } |
| 105 |
| 91 void main() { | 106 void main() { |
| 92 testIPv6toIPv6(); | 107 testIPv6toIPv6(); |
| 93 testIPv4toIPv6(); | 108 testIPv4toIPv6(); |
| 94 testIPv6toIPv4(); | 109 testIPv6toIPv4(); |
| 95 testIPv4toIPv4(); | 110 testIPv4toIPv4(); |
| 96 testIPv6Lookup(); | 111 testIPv6Lookup(); |
| 97 testIPv4Lookup(); | 112 testIPv4Lookup(); |
| 113 |
| 114 testIPv4toIPv6_IPV6Only(); |
| 98 } | 115 } |
| OLD | NEW |