diff options
author | Kenny Root <kroot@google.com> | 2015-06-10 18:38:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-10 18:38:11 +0000 |
commit | 07c642dffaa5822c216376a4882cfde5c5c4b3c2 (patch) | |
tree | 6699af31b12eb1a5deb2434141a03101890ba7d3 /luni | |
parent | eb80877fdf508af478bf59b338cab127abc54d9a (diff) | |
parent | 03814a0f775cee3003bba03d3617bcd5ea727d8b (diff) | |
download | libcore-07c642dffaa5822c216376a4882cfde5c5c4b3c2.zip libcore-07c642dffaa5822c216376a4882cfde5c5c4b3c2.tar.gz libcore-07c642dffaa5822c216376a4882cfde5c5c4b3c2.tar.bz2 |
Merge "SSLSocketTest: add test with no ciphers" into mnc-dev
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java b/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java index 89b05f3..7e05054 100644 --- a/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java +++ b/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java @@ -420,6 +420,37 @@ public class SSLSocketTest extends TestCase { c.close(); } + public void test_SSLSocket_NoEnabledCipherSuites_Failure() throws Exception { + TestSSLContext c = TestSSLContext.create(null, null, null, null, null, null, null, null, + SSLContext.getDefault(), SSLContext.getDefault()); + SSLSocket client = (SSLSocket) c.clientContext.getSocketFactory().createSocket(c.host, + c.port); + client.setEnabledCipherSuites(new String[0]); + final SSLSocket server = (SSLSocket) c.serverSocket.accept(); + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future<Void> future = executor.submit(new Callable<Void>() { + @Override + public Void call() throws Exception { + try { + server.startHandshake(); + fail(); + } catch (SSLHandshakeException expected) { + } + return null; + } + }); + executor.shutdown(); + try { + client.startHandshake(); + fail(); + } catch (SSLHandshakeException expected) { + } + future.get(); + server.close(); + client.close(); + c.close(); + } + public void test_SSLSocket_startHandshake_noKeyStore() throws Exception { TestSSLContext c = TestSSLContext.create(null, null, null, null, null, null, null, null, SSLContext.getDefault(), SSLContext.getDefault()); |