| 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:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 await singleRequest(host, port, 502); | 52 await singleRequest(host, port, 502); |
| 53 await server2.close(); | 53 await server2.close(); |
| 54 | 54 |
| 55 await server1Request.future; | 55 await server1Request.future; |
| 56 await server2Request.future; | 56 await server2Request.future; |
| 57 | 57 |
| 58 asyncEnd(); | 58 asyncEnd(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void main() { | 61 void main() { |
| 62 for (var host in ['127.0.0.1', '::1']) { | 62 // Please don't change this to use await/async. |
| 63 testBindShared(host, false); | 63 asyncStart(); |
| 64 testBindShared(host, true); | 64 supportsIPV6().then((ok) { |
| 65 var addresses = ['127.0.0.1']; |
| 66 if (ok) { |
| 67 addresses.add('::1'); |
| 68 } |
| 69 var futures = []; |
| 70 for (var host in addresses) { |
| 71 futures.add(testBindShared(host, false)); |
| 72 futures.add(testBindShared(host, true)); |
| 73 } |
| 74 Future.wait(futures).then((_) => asyncEnd()); |
| 75 }); |
| 76 } |
| 77 |
| 78 bool supportsIPV6() async { |
| 79 try { |
| 80 var socket = await ServerSocket.bind('::1', 0); |
| 81 await socket.close(); |
| 82 return true; |
| 83 } catch (e) { |
| 84 print(e); |
| 85 return false; |
| 65 } | 86 } |
| 66 } | 87 } |
| OLD | NEW |