mirror of
https://github.com/square/okhttp.git
synced 2025-07-31 05:04:26 +03:00
Get more TLS stuff passing on BouncyCastle (#7602)
There's something up with ECDSA on BouncyCastle, and rather than figuring it out I've just switched to RSA signatures with that provider.
This commit is contained in:
@ -45,9 +45,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import static okhttp3.RequestBody.gzip;
|
||||
import static okhttp3.tls.internal.TlsUtil.localhost;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
@ -59,7 +57,8 @@ public final class HttpLoggingInterceptorTest {
|
||||
@RegisterExtension public final PlatformRule platform = new PlatformRule();
|
||||
private MockWebServer server;
|
||||
|
||||
private final HandshakeCertificates handshakeCertificates = localhost();
|
||||
private final HandshakeCertificates handshakeCertificates
|
||||
= platform.localhostHandshakeCertificates();
|
||||
private final HostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();
|
||||
private OkHttpClient client;
|
||||
private String host;
|
||||
@ -848,8 +847,6 @@ public final class HttpLoggingInterceptorTest {
|
||||
}
|
||||
|
||||
@Test public void http2() throws Exception {
|
||||
platform.assumeNotBouncyCastle();
|
||||
|
||||
server.useHttps(handshakeCertificates.sslSocketFactory());
|
||||
url = server.url("/");
|
||||
|
||||
@ -930,7 +927,6 @@ public final class HttpLoggingInterceptorTest {
|
||||
|
||||
@Test public void duplexRequestsAreNotLogged() throws Exception {
|
||||
platform.assumeHttp2Support();
|
||||
platform.assumeNotBouncyCastle();
|
||||
|
||||
server.useHttps(handshakeCertificates.sslSocketFactory()); // HTTP/2
|
||||
url = server.url("/");
|
||||
|
@ -37,11 +37,9 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static okhttp3.Protocol.HTTP_1_1;
|
||||
import static okhttp3.Protocol.HTTP_2;
|
||||
import static okhttp3.tls.internal.TlsUtil.localhost;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
@ -53,7 +51,8 @@ public final class LoggingEventListenerTest {
|
||||
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();
|
||||
private MockWebServer server;
|
||||
|
||||
private final HandshakeCertificates handshakeCertificates = localhost();
|
||||
private final HandshakeCertificates handshakeCertificates
|
||||
= platform.localhostHandshakeCertificates();
|
||||
private final LogRecorder logRecorder = new LogRecorder();
|
||||
private final LoggingEventListener.Factory loggingEventListenerFactory =
|
||||
new LoggingEventListener.Factory(logRecorder);
|
||||
@ -153,7 +152,6 @@ public final class LoggingEventListenerTest {
|
||||
@Test
|
||||
public void secureGet() throws Exception {
|
||||
TestUtil.assumeNotWindows();
|
||||
platform.assumeNotBouncyCastle();
|
||||
|
||||
server.useHttps(handshakeCertificates.sslSocketFactory());
|
||||
url = server.url("/");
|
||||
@ -222,7 +220,6 @@ public final class LoggingEventListenerTest {
|
||||
@Test
|
||||
public void connectFail() {
|
||||
TestUtil.assumeNotWindows();
|
||||
platform.assumeNotBouncyCastle();
|
||||
|
||||
server.useHttps(handshakeCertificates.sslSocketFactory());
|
||||
server.setProtocols(asList(HTTP_2, HTTP_1_1));
|
||||
@ -246,9 +243,9 @@ public final class LoggingEventListenerTest {
|
||||
.assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT")
|
||||
.assertLogMatch("secureConnectStart")
|
||||
.assertLogMatch(
|
||||
"connectFailed: null javax\\.net\\.ssl\\.(?:SSLProtocolException|SSLHandshakeException): (?:Unexpected handshake message: client_hello|Handshake message sequence violation, 1|Read error|Handshake failed).*")
|
||||
"connectFailed: null \\S+(?:SSLProtocolException|SSLHandshakeException|TlsFatalAlert): (?:Unexpected handshake message: client_hello|Handshake message sequence violation, 1|Read error|Handshake failed|unexpected_message\\(10\\)).*")
|
||||
.assertLogMatch(
|
||||
"callFailed: javax\\.net\\.ssl\\.(?:SSLProtocolException|SSLHandshakeException): (?:Unexpected handshake message: client_hello|Handshake message sequence violation, 1|Read error|Handshake failed).*")
|
||||
"callFailed: \\S+(?:SSLProtocolException|SSLHandshakeException|TlsFatalAlert): (?:Unexpected handshake message: client_hello|Handshake message sequence violation, 1|Read error|Handshake failed|unexpected_message\\(10\\)).*")
|
||||
.assertNoMoreLogs();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user