summaryrefslogtreecommitdiffstats
path: root/luni/src
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-06-10 09:50:31 -0700
committerKenny Root <kroot@google.com>2015-06-10 11:05:34 -0700
commit03814a0f775cee3003bba03d3617bcd5ea727d8b (patch)
treed6d3ab54a94057f98e31f4c362d8015640fd436d /luni/src
parent28889223fc7eb311775ed70335e2d3064a58b17e (diff)
downloadlibcore-03814a0f775cee3003bba03d3617bcd5ea727d8b.zip
libcore-03814a0f775cee3003bba03d3617bcd5ea727d8b.tar.gz
libcore-03814a0f775cee3003bba03d3617bcd5ea727d8b.tar.bz2
SSLSocketTest: add test with no ciphers
If there are no ciphers set, there should just be a handshake failure. However, Conscrypt was throwing InvalidArgumentException in this configuration. (cherry picked from commit def50a267d0100fa560cf7bbcd0b9a9d5f5e068f) Bug: 21195269 Change-Id: I73cfc4927041ca9b1331b58859382573e7de6f63
Diffstat (limited to 'luni/src')
-rw-r--r--luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java31
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 8e4519d..56a639c 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());