Skip to content

Cherry pick jdk17 modules fix onto 4.9.x#6742

Merged
yschimke merged 1 commit intosquare:okhttp_4.9.xfrom
yschimke:jdk17modules
Jul 17, 2021
Merged

Cherry pick jdk17 modules fix onto 4.9.x#6742
yschimke merged 1 commit intosquare:okhttp_4.9.xfrom
yschimke:jdk17modules

Conversation

@yschimke
Copy link
Copy Markdown
Collaborator

@yschimke yschimke commented Jul 4, 2021

No description provided.

@yschimke
Copy link
Copy Markdown
Collaborator Author

yschimke commented Jul 4, 2021

Probably needs a confirmed test on 5.x before we land on 4.9.x

@yschimke yschimke marked this pull request as ready for review July 17, 2021 13:36
@yschimke
Copy link
Copy Markdown
Collaborator Author

No easy way to test this yet. This test passes with or without the fix.

package okhttp3;

import org.junit.jupiter.api.Test;

import javax.net.ssl.SSLSocketFactory;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class Jdk17Test {
    @Test
    public void testDeprecatedSslSocketFactory() {
        // https://github.com/square/okhttp/issues/6694

        SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();

        try {
            new OkHttpClient.Builder().sslSocketFactory(factory).build();
        } catch (UnsupportedOperationException uoe) {
            // expected
            assertEquals("clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on " +
                    "JDK 8 (>= 252) or JDK 9+",
                    uoe.getMessage());
        }
    }
}

@yschimke yschimke merged commit 262b3cd into square:okhttp_4.9.x Jul 17, 2021
@yschimke yschimke deleted the jdk17modules branch January 6, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants