| Index: tests/standalone/io/secure_multiple_client_server_test.dart
|
| diff --git a/tests/standalone/io/secure_multiple_client_server_test.dart b/tests/standalone/io/secure_multiple_client_server_test.dart
|
| index add0c9c1e0be619190f6408ed5a014b7afb4675a..1f53af8af5443328ccc3869fd0c07dbebaf3bd86 100644
|
| --- a/tests/standalone/io/secure_multiple_client_server_test.dart
|
| +++ b/tests/standalone/io/secure_multiple_client_server_test.dart
|
| @@ -24,7 +24,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,33 +33,36 @@ Future startServer() {
|
| return SecureServerSocket.bind(HOST, 0, serverContext).then((server) {
|
| SERVER = 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.add("Welcome, client $name".codeUnits);
|
| - 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.add("Welcome, client $name".codeUnits);
|
| + client.close();
|
| + });
|
| });
|
| });
|
| }
|
|
|
| Future testClient(name) {
|
| - return SecureSocket.connect(HOST, SERVER.port, context: clientContext)
|
| - .then((socket) {
|
| + return SecureSocket
|
| + .connect(HOST, SERVER.port, context: clientContext)
|
| + .then((socket) {
|
| socket.add("Hello from client $name".codeUnits);
|
| socket.close();
|
| - return socket.fold(<int>[], (message, data) => message..addAll(data))
|
| - .then((message) {
|
| - Expect.listEquals("Welcome, client $name".codeUnits, message);
|
| - });
|
| + return socket.fold(<int>[], (message, data) => message..addAll(data)).then(
|
| + (message) {
|
| + Expect.listEquals("Welcome, client $name".codeUnits, message);
|
| + });
|
| });
|
| }
|
|
|
| void main() {
|
| asyncStart();
|
| - InternetAddress.lookup("localhost").then((hosts) => HOST = hosts.first)
|
| + InternetAddress
|
| + .lookup("localhost")
|
| + .then((hosts) => HOST = hosts.first)
|
| .then((_) => startServer())
|
| .then((_) => ['ale', 'bar', 'che', 'den', 'els'].map(testClient))
|
| .then((futures) => Future.wait(futures))
|
|
|