Index: tests/standalone/io/socket_exception_test.dart |
diff --git a/tests/standalone/io/socket_exception_test.dart b/tests/standalone/io/socket_exception_test.dart |
index 40a58511fee55907f132f5764fd27fabd1dcaba7..d5d4e0e12c509e8568d9037acc9b900ecde4fff6 100644 |
--- a/tests/standalone/io/socket_exception_test.dart |
+++ b/tests/standalone/io/socket_exception_test.dart |
@@ -71,8 +71,9 @@ class SocketExceptionTest { |
Expect.isNotNull(server); |
int port = server.port; |
Socket.connect("127.0.0.1", port).then((client) { |
- Expect.isNotNull(client); |
+ Expect.isNotNull(client); |
client.close(); |
+ // First calls for which exceptions are note expected. |
try { |
client.close(); |
} on SocketException catch(ex) { |
@@ -87,7 +88,6 @@ class SocketExceptionTest { |
} on SocketException catch(ex) { |
exceptionCaught = true; |
} catch (ex) { |
- print(ex); |
wrongExceptionCaught = true; |
} |
Expect.isFalse(exceptionCaught); |
@@ -103,6 +103,48 @@ class SocketExceptionTest { |
Expect.isFalse(exceptionCaught); |
Expect.isFalse(wrongExceptionCaught); |
+ // From here exceptions are expected. |
+ exceptionCaught = false; |
+ try { |
+ client.port; |
+ } on SocketException catch(ex) { |
+ exceptionCaught = true; |
+ } catch (ex) { |
+ wrongExceptionCaught = true; |
+ } |
+ Expect.isTrue(exceptionCaught); |
+ Expect.isFalse(wrongExceptionCaught); |
+ exceptionCaught = false; |
+ try { |
+ client.remotePort; |
+ } on SocketException catch(ex) { |
+ exceptionCaught = true; |
+ } catch (ex) { |
+ wrongExceptionCaught = true; |
+ } |
+ Expect.isTrue(exceptionCaught); |
+ Expect.isFalse(wrongExceptionCaught); |
+ exceptionCaught = false; |
+ try { |
+ client.address; |
+ } on SocketException catch(ex) { |
+ exceptionCaught = true; |
+ } catch (ex) { |
+ wrongExceptionCaught = true; |
+ } |
+ Expect.isTrue(exceptionCaught); |
+ Expect.isFalse(wrongExceptionCaught); |
+ exceptionCaught = false; |
+ try { |
+ client.remoteAddress; |
+ } on SocketException catch(ex) { |
+ exceptionCaught = true; |
+ } catch (ex) { |
+ wrongExceptionCaught = true; |
+ } |
+ Expect.isTrue(exceptionCaught); |
+ Expect.isFalse(wrongExceptionCaught); |
+ |
server.close(); |
}); |
}); |