| 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'; |
| 11 | 11 |
| 12 testBindShared(String host, bool v6Only) async { | 12 testBindShared(String host, bool v6Only) async { |
| 13 asyncStart(); | 13 asyncStart(); |
| 14 | 14 |
| 15 // Sent a single request using a new HttpClient to ensure a new TCP | 15 // Sent a single request using a new HttpClient to ensure a new TCP |
| 16 // connnection is used. | 16 // connection is used. |
| 17 Future singleRequest(host, port, statusCode) async { | 17 Future singleRequest(host, port, statusCode) async { |
| 18 var client = new HttpClient(); | 18 var client = new HttpClient(); |
| 19 var request = await client.open('GET', host, port, '/'); | 19 var request = await client.open('GET', host, port, '/'); |
| 20 var response = await request.close(); | 20 var response = await request.close(); |
| 21 await response.drain(); | 21 await response.drain(); |
| 22 Expect.equals(statusCode, response.statusCode); | 22 Expect.equals(statusCode, response.statusCode); |
| 23 client.close(force: true); | 23 client.close(force: true); |
| 24 } | 24 } |
| 25 | 25 |
| 26 Completer server1Request = new Completer(); | 26 Completer server1Request = new Completer(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 Future<bool> supportsIPV6() async { | 78 Future<bool> supportsIPV6() async { |
| 79 try { | 79 try { |
| 80 var socket = await ServerSocket.bind('::1', 0); | 80 var socket = await ServerSocket.bind('::1', 0); |
| 81 await socket.close(); | 81 await socket.close(); |
| 82 return true; | 82 return true; |
| 83 } catch (e) { | 83 } catch (e) { |
| 84 print(e); | 84 print(e); |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 } | 87 } |
| OLD | NEW |