Index: tests/standalone/io/certificate_test_client.dart |
diff --git a/tests/standalone/io/certificate_test_client.dart b/tests/standalone/io/certificate_test_client.dart |
index f7f2fb238e0a37139cdf0d9f182541edb6b2b9ea..ff4daceeebd0f9d95eb7425f9f8b34e996f0fec9 100644 |
--- a/tests/standalone/io/certificate_test_client.dart |
+++ b/tests/standalone/io/certificate_test_client.dart |
@@ -33,9 +33,34 @@ void main() { |
SecureSocket.addCertificate(mycert, |
SecureSocket.TRUST_ISSUE_SERVER_CERTIFICATES); |
+ |
SecureSocket.connect('localhost', port).then((SecureSocket socket) { |
- socket.writeln("hello world"); |
+ socket.writeln('hello world'); |
+ socket.listen((data) { }); |
+ return socket.close(); |
+ }).then((_) { |
+ SecureSocket.changeTrust('myauthority_cert', ',,'); |
+ return SecureSocket.connect('localhost', port); |
+ }).then((_) { |
+ throw new AssertException( |
+ "Expected untrusted authority to stop connection"); |
+ }, onError: (e) { |
+ if (e is! CertificateException) throw e; |
+ }).then((_) { |
+ SecureSocket.changeTrust('myauthority_cert', 'C,,'); |
+ return SecureSocket.connect('localhost', port); |
+ }).then((SecureSocket socket) { |
+ socket.writeln('hello world'); |
socket.listen((data) { }); |
- socket.close(); |
+ return socket.close(); |
+ }).then((_) { |
+ SecureSocket.removeCertificate('myauthority_cert'); |
+ return SecureSocket.connect('localhost', port); |
+ }).then((_) { |
+ throw new AssertException("Expected untrusted root to stop connection"); |
+ }, onError: (e) { |
+ if (e is! CertificateException) throw e; |
+ }).then((_) { |
+ print('SUCCESS'); // Checked by parent process. |
}); |
} |