Index: tests/standalone/io/secure_server_closing_test.dart |
diff --git a/tests/standalone/io/secure_server_closing_test.dart b/tests/standalone/io/secure_server_closing_test.dart |
index 10a730ddca31078624c77548dcf852d270fee2be..7068d0e9d5c90f019dbe097a826723aa1a484db6 100644 |
--- a/tests/standalone/io/secure_server_closing_test.dart |
+++ b/tests/standalone/io/secure_server_closing_test.dart |
@@ -23,7 +23,7 @@ String localFile(path) => Platform.script.resolve(path).toFilePath(); |
SecurityContext serverContext = new SecurityContext() |
..useCertificateChain(localFile('certificates/server_chain.pem')) |
..usePrivateKey(localFile('certificates/server_key.pem'), |
- password: 'dartdart'); |
+ password: 'dartdart'); |
SecurityContext clientContext = new SecurityContext() |
..setTrustedCertificates(localFile('certificates/trusted_certs.pem')); |
@@ -33,38 +33,37 @@ void testCloseOneEnd(String toClose) { |
Completer serverDone = new Completer(); |
Completer serverEndDone = new Completer(); |
Completer clientEndDone = new Completer(); |
- Future.wait([serverDone.future, serverEndDone.future, clientEndDone.future]) |
- .then((_) { |
- asyncEnd(); |
- }); |
+ Future.wait([ |
+ serverDone.future, |
+ serverEndDone.future, |
+ clientEndDone.future |
+ ]).then((_) { |
+ asyncEnd(); |
+ }); |
SecureServerSocket.bind(HOST, 0, serverContext).then((server) { |
server.listen((serverConnection) { |
- serverConnection.listen( |
- (data) { |
- Expect.fail("No data should be received by server"); |
- }, |
- onDone: () { |
- serverConnection.close(); |
- serverEndDone.complete(null); |
- server.close(); |
- }); |
+ serverConnection.listen((data) { |
+ Expect.fail("No data should be received by server"); |
+ }, onDone: () { |
+ serverConnection.close(); |
+ serverEndDone.complete(null); |
+ server.close(); |
+ }); |
if (toClose == "server") { |
serverConnection.close(); |
} |
- }, |
- onDone: () { |
+ }, onDone: () { |
serverDone.complete(null); |
}); |
- SecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((clientConnection) { |
- clientConnection.listen( |
- (data) { |
- Expect.fail("No data should be received by client"); |
- }, |
- onDone: () { |
- clientConnection.close(); |
- clientEndDone.complete(null); |
- }); |
+ SecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((clientConnection) { |
+ clientConnection.listen((data) { |
+ Expect.fail("No data should be received by client"); |
+ }, onDone: () { |
+ clientConnection.close(); |
+ clientEndDone.complete(null); |
+ }); |
if (toClose == "client") { |
clientConnection.close(); |
} |
@@ -95,10 +94,9 @@ testPauseServerSocket() { |
asyncStart(); |
- SecureServerSocket.bind(HOST, |
- 0, |
- serverContext, |
- backlog: 2 * socketCount).then((server) { |
+ SecureServerSocket |
+ .bind(HOST, 0, serverContext, backlog: 2 * socketCount) |
+ .then((server) { |
Expect.isTrue(server.port > 0); |
var subscription; |
subscription = server.listen((connection) { |
@@ -115,8 +113,9 @@ testPauseServerSocket() { |
subscription.pause(); |
var connectCount = 0; |
for (int i = 0; i < socketCount; i++) { |
- SecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((connection) { |
+ SecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((connection) { |
connection.close(); |
}); |
} |
@@ -124,8 +123,9 @@ testPauseServerSocket() { |
subscription.resume(); |
resumed = true; |
for (int i = 0; i < socketCount; i++) { |
- SecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((connection) { |
+ SecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((connection) { |
connection.close(); |
}); |
} |
@@ -133,7 +133,6 @@ testPauseServerSocket() { |
}); |
} |
- |
testCloseServer() { |
const int socketCount = 3; |
var endCount = 0; |
@@ -157,8 +156,9 @@ testCloseServer() { |
}); |
for (int i = 0; i < socketCount; i++) { |
- SecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((connection) { |
+ SecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((connection) { |
ends.add(connection); |
checkDone(); |
}); |
@@ -166,7 +166,6 @@ testCloseServer() { |
}); |
} |
- |
main() { |
asyncStart(); |
InternetAddress.lookup("localhost").then((hosts) { |