Merge "Update tests for TLS 1.3 by default"
am: fdaaed4cf1
Change-Id: I20da3479909147be65d1e27e1d7815c4cf6a6112
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java
index 930fa3f..47ddb85 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java
@@ -64,10 +64,7 @@
assertEquals(-1, e.getPeerPort());
String[] suites = e.getSupportedCipherSuites();
e.setEnabledCipherSuites(suites);
- // By default, the engine only supports TLS 1.2, so the TLS 1.3 cipher suites
- // shouldn't be enabled.
- assertEquals(suites.length - StandardNames.CIPHER_SUITES_TLS13.size(),
- e.getEnabledCipherSuites().length);
+ assertEquals(suites.length, e.getEnabledCipherSuites().length);
}
/**
@@ -104,10 +101,7 @@
assertEquals(e.getPeerPort(), port);
String[] suites = e.getSupportedCipherSuites();
e.setEnabledCipherSuites(suites);
- // By default, the engine only supports TLS 1.2, so the TLS 1.3 cipher suites
- // shouldn't be enabled.
- assertEquals(suites.length - StandardNames.CIPHER_SUITES_TLS13.size(),
- e.getEnabledCipherSuites().length);
+ assertEquals(suites.length, e.getEnabledCipherSuites().length);
e.setUseClientMode(true);
assertTrue(e.getUseClientMode());
}
@@ -184,10 +178,7 @@
sse.setEnabledCipherSuites(st);
String[] res = sse.getEnabledCipherSuites();
assertNotNull("Null array was returned", res);
- // By default, the engine only supports TLS 1.2, so the TLS 1.3 cipher suites
- // shouldn't be enabled.
List<String> supported = new ArrayList<>(Arrays.asList(st));
- supported.removeAll(StandardNames.CIPHER_SUITES_TLS13);
assertEquals("Incorrect array length", res.length, supported.size());
assertEquals("Incorrect array was returned", Arrays.asList(res), supported);
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java
index 247b4e4..c61a13b 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java
@@ -229,10 +229,7 @@
sss.setEnabledCipherSuites(sss.getSupportedCipherSuites());
String[] res = sss.getEnabledCipherSuites();
assertNotNull("NULL result", res);
- // By default, the socket only supports TLS 1.2, so the TLS 1.3 cipher suites
- // shouldn't be enabled.
List<String> supported = new ArrayList<>(Arrays.asList(sss.getSupportedCipherSuites()));
- supported.removeAll(StandardNames.CIPHER_SUITES_TLS13);
assertEquals("not all supported cipher suites were enabled",
supported,
Arrays.asList(res));
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 978f20b..fe8a772 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
@@ -91,27 +91,6 @@
}
/**
- * javax.net.ssl.SSLSession#getCipherSuite()
- */
- public void test_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());
- }
-
- /**
* javax.net.ssl.SSLSession#getCreationTime()
*/
public void test_getCreationTime() {
@@ -184,7 +163,7 @@
* javax.net.ssl.SSLSession#getProtocol()
*/
public void test_getProtocol() {
- assertEquals("TLSv1.2", clientSession.getProtocol());
+ assertEquals("TLSv1.3", clientSession.getProtocol());
}
/**
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java
index d30ae53..c23b56b 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java
@@ -373,10 +373,7 @@
ssl.setEnabledCipherSuites(ssl.getSupportedCipherSuites());
String[] res = ssl.getEnabledCipherSuites();
assertNotNull("NULL result", res);
- // By default, the socket only supports TLS 1.2, so the TLS 1.3 cipher suites
- // shouldn't be enabled.
List<String> supported = new ArrayList<>(Arrays.asList(ssl.getSupportedCipherSuites()));
- supported.removeAll(StandardNames.CIPHER_SUITES_TLS13);
assertEquals("not all supported cipher suites were enabled",
supported,
Arrays.asList(res));