Index: tests/standalone/io/socket_bind_test.dart |
diff --git a/tests/standalone/io/socket_bind_test.dart b/tests/standalone/io/socket_bind_test.dart |
index f701f0c806109cad0db7dfbdad65763f8baa8a3a..08963eb36bcc0f949c9d31e1fb57d1ac7377e1fb 100644 |
--- a/tests/standalone/io/socket_bind_test.dart |
+++ b/tests/standalone/io/socket_bind_test.dart |
@@ -4,11 +4,12 @@ |
import 'dart:async'; |
import 'dart:io'; |
-import 'dart:convert'; |
import 'package:async_helper/async_helper.dart'; |
import 'package:expect/expect.dart'; |
+import 'test_utils.dart' show freeIPv4AndIPv6Port, retry; |
+ |
testBindShared(String host, bool v6Only) { |
asyncStart(); |
ServerSocket.bind( |
@@ -112,27 +113,6 @@ testListenCloseListenClose(String host) async { |
asyncEnd(); |
} |
-Future<int> freeIPv4AndIPv6Port() async { |
- var socket = |
- await ServerSocket.bind(InternetAddress.ANY_IP_V6, 0, v6Only: false); |
- int port = socket.port; |
- await socket.close(); |
- return port; |
-} |
- |
-Future retry(Future fun(), {int maxCount: 10}) async { |
- for (int i = 0; i < maxCount; i++) { |
- try { |
- // If there is no exception this will simply return, otherwise we keep |
- // trying. |
- return await fun(); |
- } catch (_) {} |
- print("Failed to execute test closure in attempt $i " |
- "(${maxCount - i} retries left)."); |
- } |
- return await fun(); |
-} |
- |
main() async { |
asyncStart(); |