diff options
author | Kenny Root <kroot@google.com> | 2015-06-10 18:38:26 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-10 18:38:27 +0000 |
commit | 3a2b724df2b617c4ed421215bab68ac4497d18f5 (patch) | |
tree | 3866dd26ba3f24850638c98541eec55d60ba28cd /harmony-tests/src/test | |
parent | 07c642dffaa5822c216376a4882cfde5c5c4b3c2 (diff) | |
parent | 229d56846bd56df1b2b6942a25127003bde88222 (diff) | |
download | libcore-3a2b724df2b617c4ed421215bab68ac4497d18f5.zip libcore-3a2b724df2b617c4ed421215bab68ac4497d18f5.tar.gz libcore-3a2b724df2b617c4ed421215bab68ac4497d18f5.tar.bz2 |
Merge "SSLEngineTest: set up server instead of using anon" into mnc-dev
Diffstat (limited to 'harmony-tests/src/test')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java | 21 |
1 files changed, 7 insertions, 14 deletions
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 8f68d6e..9360c00 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 @@ -36,6 +36,7 @@ import javax.net.ssl.SSLException; import javax.net.ssl.SSLEngineResult.HandshakeStatus; import junit.framework.TestCase; import libcore.java.security.StandardNames; +import libcore.javax.net.ssl.TestSSLContext; /** * Tests for SSLEngine class @@ -1042,21 +1043,12 @@ public class SSLEngineTest extends TestCase { private ByteBuffer writeBuffer; - HandshakeHandler(boolean clientMode, SourceChannel in, SinkChannel out) throws Exception { + HandshakeHandler(SSLContext context, boolean clientMode, SourceChannel in, SinkChannel out) + throws Exception { this.in = in; this.out = out; - engine = getEngine(); + engine = context.createSSLEngine(); engine.setUseClientMode(clientMode); - String[] cipherSuites = engine.getSupportedCipherSuites(); - Set<String> enabledSuites = new HashSet<String>(); - for (String cipherSuite : cipherSuites) { - if (cipherSuite.contains("anon")) { - enabledSuites.add(cipherSuite); - } - } - engine.setEnabledCipherSuites((String[]) enabledSuites.toArray( - new String[enabledSuites.size()])); - engine.beginHandshake(); status = engine.getHandshakeStatus(); @@ -1179,8 +1171,9 @@ public class SSLEngineTest extends TestCase { SinkChannel serverSink = serverSendPipe.sink(); SourceChannel clientSource = serverSendPipe.source(); - clientEngine = new HandshakeHandler(true, clientSource, clientSink); - serverEngine = new HandshakeHandler(false, serverSource, serverSink); + TestSSLContext context = TestSSLContext.create(); + clientEngine = new HandshakeHandler(context.clientContext, true, clientSource, clientSink); + serverEngine = new HandshakeHandler(context.serverContext, false, serverSource, serverSink); } boolean doHandshake() throws InterruptedException { |