| Index: tests/standalone/io/raw_secure_server_socket_test.dart
|
| diff --git a/tests/standalone/io/raw_secure_server_socket_test.dart b/tests/standalone/io/raw_secure_server_socket_test.dart
|
| index 7b5ef57ba725182d8954fcd528e75565e4fb322c..1ab22db6ca63b6c2234caee94d0dcc70e75a4530 100644
|
| --- a/tests/standalone/io/raw_secure_server_socket_test.dart
|
| +++ b/tests/standalone/io/raw_secure_server_socket_test.dart
|
| @@ -30,10 +30,12 @@ SecurityContext clientContext = new SecurityContext()
|
| ..setTrustedCertificates(localFile('certificates/trusted_certs.pem'));
|
|
|
| void testSimpleBind() {
|
| + print("asyncStart testSimpleBind");
|
| asyncStart();
|
| RawSecureServerSocket.bind(HOST, 0, serverContext).then((s) {
|
| Expect.isTrue(s.port > 0);
|
| s.close();
|
| + print("asyncEnd testSimpleBind");
|
| asyncEnd();
|
| });
|
| }
|
| @@ -43,24 +45,29 @@ void testInvalidBind() {
|
|
|
| // Bind to a unknown DNS name.
|
| asyncStart();
|
| + print("asyncStart testInvalidBind");
|
| RawSecureServerSocket.bind("ko.faar.__hest__", 0, serverContext).then((_) {
|
| Expect.fail("Failure expected");
|
| }).catchError((error) {
|
| Expect.isTrue(error is SocketException);
|
| + print("asyncEnd testInvalidBind");
|
| asyncEnd();
|
| });
|
|
|
| // Bind to an unavaliable IP-address.
|
| asyncStart();
|
| + print("asyncStart testInvalidBind 2");
|
| RawSecureServerSocket.bind("8.8.8.8", 0, serverContext).then((_) {
|
| Expect.fail("Failure expected");
|
| }).catchError((error) {
|
| Expect.isTrue(error is SocketException);
|
| + print("asyncEnd testInvalidBind 2");
|
| asyncEnd();
|
| });
|
|
|
| // Bind to a port already in use.
|
| asyncStart();
|
| + print("asyncStart testInvalidBind 3");
|
| RawSecureServerSocket.bind(HOST, 0, serverContext).then((s) {
|
| RawSecureServerSocket.bind(HOST,
|
| s.port,
|
| @@ -72,12 +79,14 @@ void testInvalidBind() {
|
| .catchError((error) {
|
| Expect.isTrue(error is SocketException);
|
| s.close();
|
| + print("asyncEnd testInvalidBind 3");
|
| asyncEnd();
|
| });
|
| });
|
| }
|
|
|
| void testSimpleConnect() {
|
| + print("asyncStart testSimpleConnect");
|
| asyncStart();
|
| RawSecureServerSocket.bind(HOST, 0, serverContext).then((server) {
|
| var clientEndFuture =
|
| @@ -88,13 +97,17 @@ void testSimpleConnect() {
|
| clientEnd.shutdown(SocketDirection.SEND);
|
| serverEnd.shutdown(SocketDirection.SEND);
|
| server.close();
|
| + print("asyncEnd testSimpleConnect");
|
| asyncEnd();
|
| });
|
| });
|
| });
|
| }
|
|
|
| +int debugTestSimpleConnectFailCounter = 0;
|
| void testSimpleConnectFail(SecurityContext context, bool cancelOnError) {
|
| + var counter = debugTestSimpleConnectFailCounter++;
|
| + print("asyncStart testSimpleConnectFail $counter");
|
| asyncStart();
|
| RawSecureServerSocket.bind(HOST, 0, context).then((server) {
|
| var clientEndFuture =
|
| @@ -114,6 +127,7 @@ void testSimpleConnectFail(SecurityContext context, bool cancelOnError) {
|
| error is HandshakeException);
|
| clientEndFuture.then((_) {
|
| if (!cancelOnError) server.close();
|
| + print("asyncEnd testSimpleConnectFail $counter");
|
| asyncEnd();
|
| });
|
| },
|
| @@ -122,6 +136,7 @@ void testSimpleConnectFail(SecurityContext context, bool cancelOnError) {
|
| }
|
|
|
| void testServerListenAfterConnect() {
|
| + print("asyncStart testServerListenAfterConnect");
|
| asyncStart();
|
| RawSecureServerSocket.bind(HOST, 0, serverContext).then((server) {
|
| Expect.isTrue(server.port > 0);
|
| @@ -133,6 +148,7 @@ void testServerListenAfterConnect() {
|
| clientEnd.shutdown(SocketDirection.SEND);
|
| serverEnd.shutdown(SocketDirection.SEND);
|
| server.close();
|
| + print("asyncEnd testServerListenAfterConnect");
|
| asyncEnd();
|
| });
|
| });
|
| @@ -182,6 +198,8 @@ void testSimpleReadWrite({bool listenSecure,
|
| Expect.fail("Invalid arguments to testSimpleReadWrite");
|
| }
|
|
|
| + print("asyncStart testSimpleReadWrite($listenSecure, $connectSecure, "
|
| + "$handshakeBeforeSecure, $postponeSecure, $dropReads");
|
| asyncStart();
|
|
|
| const messageSize = 1000;
|
| @@ -479,6 +497,8 @@ void testSimpleReadWrite({bool listenSecure,
|
|
|
| connectClient(server.port).then(runClient).then((socket) {
|
| socket.close();
|
| + print("asyncEnd testSimpleReadWrite($listenSecure, $connectSecure, "
|
| + "$handshakeBeforeSecure, $postponeSecure, $dropReads");
|
| asyncEnd();
|
| });
|
| }
|
| @@ -492,6 +512,8 @@ void testSimpleReadWrite({bool listenSecure,
|
| }
|
|
|
| testPausedSecuringSubscription(bool pausedServer, bool pausedClient) {
|
| + print(
|
| + "asyncStart testPausedSecuringSubscription $pausedServer $pausedClient");
|
| asyncStart();
|
| var clientComplete = new Completer();
|
| RawServerSocket.bind(HOST, 0).then((server) {
|
| @@ -505,6 +527,8 @@ testPausedSecuringSubscription(bool pausedServer, bool pausedClient) {
|
| server.close();
|
| clientComplete.future.then((_) {
|
| client.close();
|
| + print("asyncEnd testPausedSecuringSubscription "
|
| + "$pausedServer $pausedClient");
|
| asyncEnd();
|
| });
|
| }
|
| @@ -562,10 +586,12 @@ testPausedSecuringSubscription(bool pausedServer, bool pausedClient) {
|
| }
|
|
|
| main() {
|
| + print("asyncStart main");
|
| asyncStart();
|
| InternetAddress.lookup("localhost").then((hosts) {
|
| HOST = hosts.first;
|
| runTests();
|
| + print("asyncEnd main");
|
| asyncEnd();
|
| });
|
| }
|
|
|