Index: tests/standalone/io/secure_session_resume_test.dart |
diff --git a/tests/standalone/io/secure_session_resume_test.dart b/tests/standalone/io/secure_session_resume_test.dart |
index f48a88803751e3d1c87c12f4417bdd60ab27c3eb..8f7ae8a4586b003dd4b03f789a6dff05645b56ad 100644 |
--- a/tests/standalone/io/secure_session_resume_test.dart |
+++ b/tests/standalone/io/secure_session_resume_test.dart |
@@ -33,39 +33,38 @@ 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')); |
Future<SecureServerSocket> startServer() { |
- return SecureServerSocket.bind(HOST, |
- 0, |
- serverContext).then((server) { |
+ return SecureServerSocket.bind(HOST, 0, serverContext).then((server) { |
server.listen((SecureSocket client) { |
- client.fold(<int>[], (message, data) => message..addAll(data)) |
- .then((message) { |
- String received = new String.fromCharCodes(message); |
- Expect.isTrue(received.contains("Hello from client ")); |
- String name = received.substring(received.indexOf("client ") + 7); |
- client.write("Welcome, client $name"); |
- client.close(); |
- }); |
+ client.fold(<int>[], (message, data) => message..addAll(data)).then( |
+ (message) { |
+ String received = new String.fromCharCodes(message); |
+ Expect.isTrue(received.contains("Hello from client ")); |
+ String name = received.substring(received.indexOf("client ") + 7); |
+ client.write("Welcome, client $name"); |
+ client.close(); |
+ }); |
}); |
return server; |
}); |
} |
Future testClient(server, name) { |
- return SecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((socket) { |
+ return SecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((socket) { |
socket.write("Hello from client $name"); |
socket.close(); |
- return socket.fold(<int>[], (message, data) => message..addAll(data)) |
- .then((message) { |
- Expect.listEquals("Welcome, client $name".codeUnits, message); |
- return server; |
- }); |
+ return socket.fold(<int>[], (message, data) => message..addAll(data)).then( |
+ (message) { |
+ Expect.listEquals("Welcome, client $name".codeUnits, message); |
+ return server; |
+ }); |
}); |
} |
@@ -81,12 +80,11 @@ Future runTests() { |
Duration delay = const Duration(milliseconds: 0); |
Duration delay_between_connections = const Duration(milliseconds: 300); |
return startServer() |
- .then((server) => Future.wait( |
- ['able', 'baker', 'charlie', 'dozen', 'elapse'] |
- .map((name) { |
+ .then((server) => Future |
+ .wait(['able', 'baker', 'charlie', 'dozen', 'elapse'].map((name) { |
delay += delay_between_connections; |
return new Future.delayed(delay, () => server) |
- .then((server) => testClient(server, name)); |
+ .then((server) => testClient(server, name)); |
}))) |
.then((servers) => servers.first.close()); |
} |