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 6946a4b0f23e9a122c4977b6cba8b472e08dfbdd..1345ebadcb98e7003c26238dbea161a3710fbbe9 100644 |
--- a/tests/standalone/io/socket_bind_test.dart |
+++ b/tests/standalone/io/socket_bind_test.dart |
@@ -12,13 +12,13 @@ import 'test_utils.dart' show freeIPv4AndIPv6Port, retry; |
testBindShared(String host, bool v6Only) { |
asyncStart(); |
- ServerSocket.bind( |
- host, 0, v6Only: v6Only, shared: true).then((socket) { |
+ ServerSocket.bind(host, 0, v6Only: v6Only, shared: true).then((socket) { |
Expect.isTrue(socket.port > 0); |
asyncStart(); |
- return ServerSocket.bind( |
- host, socket.port, v6Only: v6Only, shared: true).then((socket2) { |
+ return ServerSocket |
+ .bind(host, socket.port, v6Only: v6Only, shared: true) |
+ .then((socket2) { |
Expect.equals(socket.address.address, socket2.address.address); |
Expect.equals(socket.port, socket2.port); |
socket.close().whenComplete(asyncEnd); |
@@ -33,8 +33,9 @@ negTestBindSharedMismatch(String host, bool v6Only) { |
Expect.isTrue(socket.port > 0); |
asyncStart(); |
- return ServerSocket.bind( |
- host, socket.port, v6Only: v6Only).catchError((error) { |
+ return ServerSocket |
+ .bind(host, socket.port, v6Only: v6Only) |
+ .catchError((error) { |
Expect.isTrue(error is SocketException); |
Expect.isTrue('$error'.contains('shared flag')); |
socket.close().whenComplete(asyncEnd); |
@@ -45,13 +46,14 @@ negTestBindSharedMismatch(String host, bool v6Only) { |
negTestBindV6OnlyMismatch(String host, bool v6Only) { |
asyncStart(); |
- ServerSocket.bind( |
- host, 0, v6Only: v6Only, shared: true).then((ServerSocket socket) { |
+ ServerSocket |
+ .bind(host, 0, v6Only: v6Only, shared: true) |
+ .then((ServerSocket socket) { |
Expect.isTrue(socket.port > 0); |
asyncStart(); |
- return ServerSocket.bind( |
- host, socket.port, v6Only: !v6Only, shared: true) |
+ return ServerSocket |
+ .bind(host, socket.port, v6Only: !v6Only, shared: true) |
.catchError((error) { |
Expect.isTrue(error is SocketException); |
Expect.isTrue('$error'.contains('v6Only flag')); |
@@ -61,20 +63,18 @@ negTestBindV6OnlyMismatch(String host, bool v6Only) { |
}); |
} |
-Future testBindDifferentAddresses(InternetAddress addr1, |
- InternetAddress addr2, |
- bool addr1V6Only, |
- bool addr2V6Only) async { |
+Future testBindDifferentAddresses(InternetAddress addr1, InternetAddress addr2, |
+ bool addr1V6Only, bool addr2V6Only) async { |
int freePort = await freeIPv4AndIPv6Port(); |
- var socket = await ServerSocket.bind( |
- addr1, freePort, v6Only: addr1V6Only, shared: false); |
+ var socket = await ServerSocket.bind(addr1, freePort, |
+ v6Only: addr1V6Only, shared: false); |
try { |
Expect.isTrue(socket.port > 0); |
- var socket2 = await ServerSocket.bind( |
- addr2, freePort, v6Only: addr2V6Only, shared: false); |
+ var socket2 = await ServerSocket.bind(addr2, freePort, |
+ v6Only: addr2V6Only, shared: false); |
try { |
Expect.equals(socket.port, socket2.port); |
} finally { |
@@ -88,12 +88,13 @@ Future testBindDifferentAddresses(InternetAddress addr1, |
testListenCloseListenClose(String host) async { |
asyncStart(); |
- ServerSocket socket = |
- await ServerSocket.bind(host, 0, shared: true); |
+ ServerSocket socket = await ServerSocket.bind(host, 0, shared: true); |
ServerSocket socket2 = |
await ServerSocket.bind(host, socket.port, shared: true); |
- var subscription = socket.listen((_) { throw 'error'; }); |
+ var subscription = socket.listen((_) { |
+ throw 'error'; |
+ }); |
subscription.cancel(); |
await socket.close(); |
@@ -119,16 +120,12 @@ main() async { |
asyncStart(); |
await retry(() async { |
- await testBindDifferentAddresses(InternetAddress.ANY_IP_V6, |
- InternetAddress.ANY_IP_V4, |
- true, |
- false); |
+ await testBindDifferentAddresses( |
+ InternetAddress.ANY_IP_V6, InternetAddress.ANY_IP_V4, true, false); |
}); |
await retry(() async { |
- await testBindDifferentAddresses(InternetAddress.ANY_IP_V4, |
- InternetAddress.ANY_IP_V6, |
- false, |
- true); |
+ await testBindDifferentAddresses( |
+ InternetAddress.ANY_IP_V4, InternetAddress.ANY_IP_V6, false, true); |
}); |
for (var host in ['127.0.0.1', '::1']) { |