diff options
author | Alex Klyubin <klyubin@google.com> | 2014-01-13 11:44:14 -0800 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2014-01-13 11:44:14 -0800 |
commit | b52bc3ea9e79642c275ea6d9ac2342b5746e55c9 (patch) | |
tree | 2f22b15f35d67450694f6bfa68c9eca07ae301e5 /harmony-tests | |
parent | f61414d30267b77dc313285d7f72c72b61e51302 (diff) | |
download | libcore-b52bc3ea9e79642c275ea6d9ac2342b5746e55c9.zip libcore-b52bc3ea9e79642c275ea6d9ac2342b5746e55c9.tar.gz libcore-b52bc3ea9e79642c275ea6d9ac2342b5746e55c9.tar.bz2 |
Fix test breakage in Harmony SSLSessionTest.
The breakage was caused by the SSLSessionTest assuming that TLS/SSL
connections by default handshake to the SSL_RSA_WITH_RC4_128_MD5 cipher suite.
Bug: 11220570
Change-Id: Ib1ac44f83c968ec3dc7432339e1fc0f64d63733f
Diffstat (limited to 'harmony-tests')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java index 4bd7c79..2ba913d 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java @@ -17,6 +17,7 @@ package tests.api.javax.net.ssl; +import libcore.java.security.StandardNames; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.OutputStream; @@ -88,7 +89,21 @@ public class SSLSessionTest extends TestCase { * javax.net.ssl.SSLSession#getCipherSuite() */ public void test_getCipherSuite() { - assertEquals(CIPHER_SUITE, clientSession.getCipherSuite()); + // Identify the expected cipher suite from the expected list of cipher suites enabled by + // default. + // This test class initializes the server with an RSA key. Thus, only cipher suites that + // authenticate the server using RSA are expected to be used. + String expectedCipherSuite = null; + for (String cipherSuite : StandardNames.CIPHER_SUITES_DEFAULT) { + if (cipherSuite.contains("_RSA_")) { + expectedCipherSuite = cipherSuite; + break; + } + } + if (expectedCipherSuite == null) { + fail("Failed to identify expected cipher suite"); + } + assertEquals(expectedCipherSuite, clientSession.getCipherSuite()); } /** @@ -384,7 +399,6 @@ public class SSLSessionTest extends TestCase { + "uJk07h3IZnNxE+/IKgeMTP/H4+jmyT4mhsexJ2BFHeiKF1KT/FMcJdSi+ZK5yoNVcYuY8aZbx0Ef" + "lHorCXAmLFB0W6Cz4KPP01nD9YBB4olxiK1t7m0AU9zscdivNiuUaB5OIEr+JuZ6dNw="; - private static final String CIPHER_SUITE = "SSL_RSA_WITH_RC4_128_MD5"; /** * Defines the keystore contents for the server, JKS version. Holds just a * single self-generated key. The subject name is "Test Server". |