Index: tests/standalone/io/raw_secure_socket_pause_test.dart |
diff --git a/tests/standalone/io/raw_secure_socket_pause_test.dart b/tests/standalone/io/raw_secure_socket_pause_test.dart |
index 5d9b8f63e63b8049270b5738bb02d8d748b006de..124238ff26b17100bc3650b8fddf2fbcdc64bb8b 100644 |
--- a/tests/standalone/io/raw_secure_socket_pause_test.dart |
+++ b/tests/standalone/io/raw_secure_socket_pause_test.dart |
@@ -21,27 +21,23 @@ 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<HttpServer> startServer() { |
- return HttpServer.bindSecure( |
- "localhost", |
- 0, |
- serverContext, |
- backlog: 5).then((server) { |
+ return HttpServer |
+ .bindSecure("localhost", 0, serverContext, backlog: 5) |
+ .then((server) { |
server.listen((HttpRequest request) { |
- request.listen( |
- (_) { }, |
- onDone: () { |
- request.response.contentLength = 100; |
- for (int i = 0; i < 10; i++) { |
- request.response.add([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); |
- } |
- request.response.close(); |
- }); |
+ request.listen((_) {}, onDone: () { |
+ request.response.contentLength = 100; |
+ for (int i = 0; i < 10; i++) { |
+ request.response.add([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); |
+ } |
+ request.response.close(); |
+ }); |
}); |
return server; |
}); |
@@ -52,9 +48,8 @@ main() async { |
int written = 0; |
List<int> body = <int>[]; |
var server = await startServer(); |
- var socket = await RawSecureSocket.connect("localhost", |
- server.port, |
- context: clientContext); |
+ var socket = await RawSecureSocket.connect("localhost", server.port, |
+ context: clientContext); |
StreamSubscription subscription; |
bool paused = false; |
bool readEventsTested = false; |
@@ -64,8 +59,8 @@ main() async { |
subscription.pause(); |
paused = true; |
new Timer(const Duration(milliseconds: 500), () { |
- paused = false; |
- subscription.resume(); |
+ paused = false; |
+ subscription.resume(); |
}); |
} |
@@ -75,8 +70,8 @@ main() async { |
socket.readEventsEnabled = false; |
readEventsPaused = true; |
new Timer(const Duration(milliseconds: 500), () { |
- readEventsPaused = false; |
- socket.readEventsEnabled = true; |
+ readEventsPaused = false; |
+ socket.readEventsEnabled = true; |
}); |
} |
@@ -89,8 +84,7 @@ main() async { |
body.addAll(socket.read()); |
break; |
case RawSocketEvent.WRITE: |
- written += |
- socket.write(message, written, message.length - written); |
+ written += socket.write(message, written, message.length - written); |
if (written < message.length) { |
socket.writeEventsEnabled = true; |
} else { |
@@ -104,15 +98,14 @@ main() async { |
Expect.equals(9, body.last); |
server.close(); |
break; |
- default: throw "Unexpected event $event"; |
+ default: |
+ throw "Unexpected event $event"; |
} |
} |
- subscription = socket.listen( |
- handleRawEvent, |
- onError: (e, trace) { |
- String msg = "onError handler of RawSecureSocket stream hit: $e"; |
- if (trace != null) msg += "\nStackTrace: $trace"; |
- Expect.fail(msg); |
- }); |
+ subscription = socket.listen(handleRawEvent, onError: (e, trace) { |
+ String msg = "onError handler of RawSecureSocket stream hit: $e"; |
+ if (trace != null) msg += "\nStackTrace: $trace"; |
+ Expect.fail(msg); |
+ }); |
} |