diff options
author | Neil Fuller <nfuller@google.com> | 2014-10-24 08:15:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-10-24 08:15:15 +0000 |
commit | 489419fffcc77a23848cbcf43f3b7efadd635fbc (patch) | |
tree | e31b5f108e25050232bba8c51f95fe656af744c7 /luni/src/test | |
parent | ed7443236cd820032b3c44f1db34ee384eede59b (diff) | |
parent | 728cf54794721668325f00bb72dc177d959d8c84 (diff) | |
download | libcore-489419fffcc77a23848cbcf43f3b7efadd635fbc.zip libcore-489419fffcc77a23848cbcf43f3b7efadd635fbc.tar.gz libcore-489419fffcc77a23848cbcf43f3b7efadd635fbc.tar.bz2 |
Merge "Add an additional regression test for SSLSocketTest."
Diffstat (limited to 'luni/src/test')
-rw-r--r-- | luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java | 38 |
1 files changed, 38 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 10cf159..4681877 100644 --- a/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java +++ b/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java @@ -1608,6 +1608,42 @@ public class SSLSocketTest extends TestCase { context.close(); } + // Confirms that communication without the TLS_FALLBACK_SCSV cipher works as it always did. + public void test_SSLSocket_sendsNoTlsFallbackScsv_Fallback_Success() throws Exception { + TestSSLContext context = TestSSLContext.create(); + + final SSLSocket client = (SSLSocket) + context.clientContext.getSocketFactory().createSocket(context.host, context.port); + final SSLSocket server = (SSLSocket) context.serverSocket.accept(); + + // Confirm absence of TLS_FALLBACK_SCSV. + assertFalse(Arrays.asList(client.getEnabledCipherSuites()) + .contains(StandardNames.CIPHER_SUITE_FALLBACK)); + + ExecutorService executor = Executors.newFixedThreadPool(2); + Future<Void> s = executor.submit(new Callable<Void>() { + public Void call() throws Exception { + server.setEnabledProtocols(new String[] { "TLSv1", "SSLv3" }); + server.startHandshake(); + return null; + } + }); + Future<Void> c = executor.submit(new Callable<Void>() { + public Void call() throws Exception { + client.setEnabledProtocols(new String[] { "SSLv3" }); + client.startHandshake(); + return null; + } + }); + executor.shutdown(); + + s.get(); + c.get(); + client.close(); + server.close(); + context.close(); + } + public void test_SSLSocket_sendsTlsFallbackScsv_InappropriateFallback_Failure() throws Exception { TestSSLContext context = TestSSLContext.create(); @@ -1616,6 +1652,8 @@ public class SSLSocketTest extends TestCase { final SSLSocket server = (SSLSocket) context.serverSocket.accept(); final String[] serverCipherSuites = server.getEnabledCipherSuites(); + + // Add TLS_FALLBACK_SCSV final String[] clientCipherSuites = new String[serverCipherSuites.length + 1]; System.arraycopy(serverCipherSuites, 0, clientCipherSuites, 0, serverCipherSuites.length); clientCipherSuites[serverCipherSuites.length] = StandardNames.CIPHER_SUITE_FALLBACK; |