Index: tests/standalone/io/raw_secure_server_closing_test.dart |
diff --git a/tests/standalone/io/raw_secure_server_closing_test.dart b/tests/standalone/io/raw_secure_server_closing_test.dart |
index fc7301860d5a92d10d1d1f440eb855a42ec10691..9bae586b371288a3ed206bdf33213e1421fd0a60 100644 |
--- a/tests/standalone/io/raw_secure_server_closing_test.dart |
+++ b/tests/standalone/io/raw_secure_server_closing_test.dart |
@@ -22,7 +22,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')); |
@@ -32,32 +32,33 @@ 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(); |
+ }); |
RawSecureServerSocket.bind(HOST, 0, serverContext).then((server) { |
server.listen((serverConnection) { |
serverConnection.listen((event) { |
if (toClose == "server" || event == RawSocketEvent.READ_CLOSED) { |
serverConnection.shutdown(SocketDirection.SEND); |
} |
- }, |
- onDone: () { |
+ }, onDone: () { |
serverEndDone.complete(null); |
}); |
- }, |
- onDone: () { |
+ }, onDone: () { |
serverDone.complete(null); |
}); |
- RawSecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((clientConnection) { |
- clientConnection.listen((event){ |
+ RawSecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((clientConnection) { |
+ clientConnection.listen((event) { |
if (toClose == "client" || event == RawSocketEvent.READ_CLOSED) { |
clientConnection.shutdown(SocketDirection.SEND); |
} |
- }, |
- onDone: () { |
+ }, onDone: () { |
clientEndDone.complete(null); |
server.close(); |
}); |
@@ -88,10 +89,9 @@ testPauseServerSocket() { |
asyncStart(); |
- RawSecureServerSocket.bind(HOST, |
- 0, |
- serverContext, |
- backlog: 2 * socketCount).then((server) { |
+ RawSecureServerSocket |
+ .bind(HOST, 0, serverContext, backlog: 2 * socketCount) |
+ .then((server) { |
Expect.isTrue(server.port > 0); |
var subscription; |
subscription = server.listen((connection) { |
@@ -109,8 +109,9 @@ testPauseServerSocket() { |
subscription.pause(); |
var connectCount = 0; |
for (int i = 0; i < socketCount; i++) { |
- RawSecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((connection) { |
+ RawSecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((connection) { |
connection.shutdown(SocketDirection.SEND); |
}); |
} |
@@ -118,8 +119,9 @@ testPauseServerSocket() { |
subscription.resume(); |
resumed = true; |
for (int i = 0; i < socketCount; i++) { |
- RawSecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((connection) { |
+ RawSecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((connection) { |
connection.shutdown(SocketDirection.SEND); |
}); |
} |
@@ -149,8 +151,9 @@ testCloseServer() { |
}); |
for (int i = 0; i < socketCount; i++) { |
- RawSecureSocket.connect(HOST, server.port, context: clientContext) |
- .then((connection) { |
+ RawSecureSocket |
+ .connect(HOST, server.port, context: clientContext) |
+ .then((connection) { |
ends.add(connection); |
checkDone(); |
}); |
@@ -158,7 +161,6 @@ testCloseServer() { |
}); |
} |
- |
main() { |
asyncStart(); |
InternetAddress.lookup("localhost").then((hosts) { |