diff options
author | Neil Fuller <nfuller@google.com> | 2014-11-12 02:42:37 +0000 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2014-11-21 16:46:31 +0000 |
commit | ce0ccd0299a8c23666a630afa4e440963e457615 (patch) | |
tree | f7878c5ed0003b0d63e3cd569e11c377f757c141 /luni/src/test | |
parent | 3d8b8972ae0f5bc4c63964fbfad3b9e03463ce50 (diff) | |
download | libcore-ce0ccd0299a8c23666a630afa4e440963e457615.zip libcore-ce0ccd0299a8c23666a630afa4e440963e457615.tar.gz libcore-ce0ccd0299a8c23666a630afa4e440963e457615.tar.bz2 |
Fixes associated with OkHttp fallback changes
OkHttp now selects from the available, enabled protocols rather
than forcing SSLv3 to be on. Without this change, if SSLv3 is not
part of the protocols enabled by default on the device this test
would fail.
Bug: 13228108
Change-Id: I5b89a73af9cf729dbf892f958fa318daa4109ff4
Diffstat (limited to 'luni/src/test')
-rw-r--r-- | luni/src/test/java/libcore/java/net/URLConnectionTest.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java index 714df2c..a94f0be 100644 --- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java +++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java @@ -2192,13 +2192,10 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest public void testSslFallback() throws Exception { TestSSLContext testSSLContext = TestSSLContext.create(); - // Android now disables SSLv3 by default. To test fallback we re-enable it for the server. - // This can be removed once OkHttp is updated to support other fallback protocols. SSLSocketFactory serverSocketFactory = new LimitedProtocolsSocketFactory( testSSLContext.serverContext.getSocketFactory(), "TLSv1", "SSLv3"); - server.useHttps(serverSocketFactory, false); server.enqueue(new MockResponse().setSocketPolicy(FAIL_HANDSHAKE)); server.enqueue(new MockResponse().setBody("This required a 2nd handshake")); @@ -2208,7 +2205,9 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest // Keeps track of the client sockets created so that we can interrogate them. final boolean disableFallbackScsv = true; FallbackTestClientSocketFactory clientSocketFactory = new FallbackTestClientSocketFactory( - testSSLContext.clientContext.getSocketFactory(), disableFallbackScsv); + new LimitedProtocolsSocketFactory( + testSSLContext.clientContext.getSocketFactory(), "TLSv1", "SSLv3"), + disableFallbackScsv); connection.setSSLSocketFactory(clientSocketFactory); assertEquals("This required a 2nd handshake", readAscii(connection.getInputStream(), Integer.MAX_VALUE)); @@ -2224,14 +2223,14 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest (TlsFallbackDisabledScsvSSLSocket) createdSockets.get(0); List<String> clientSocket1EnabledProtocols = Arrays.asList( clientSocket1.getEnabledProtocols()); - assertContains(clientSocket1EnabledProtocols, "TLSv1.2"); + assertContains(clientSocket1EnabledProtocols, "TLSv1"); assertFalse(clientSocket1.wasTlsFallbackScsvSet()); TlsFallbackDisabledScsvSSLSocket clientSocket2 = (TlsFallbackDisabledScsvSSLSocket) createdSockets.get(1); List<String> clientSocket2EnabledProtocols = Arrays.asList(clientSocket2.getEnabledProtocols()); - assertContainsNoneMatching(clientSocket2EnabledProtocols, "TLSv1.2"); + assertContainsNoneMatching(clientSocket2EnabledProtocols, "TLSv1"); assertTrue(clientSocket2.wasTlsFallbackScsvSet()); } |