Skip to content

Commit

Permalink
JDK 1.8 build fix
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
  • Loading branch information
senivam committed Nov 1, 2022
1 parent cd08a8d commit 4c55205
Showing 1 changed file with 23 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -16,11 +16,30 @@

package org.glassfish.jersey.jdk.connector.internal;

import java.util.Arrays;

import javax.net.ssl.SSLContext;

import org.junit.AfterClass;
import org.junit.BeforeClass;

public class SslFilterTLS13Test extends SslFilterTest {

public SslFilterTLS13Test() {
System.setProperty("jdk.tls.server.protocols", "TLSv1.3");
System.setProperty("jdk.tls.client.protocols", "TLSv1.3");
@BeforeClass
public static void setup() throws Exception {
final SSLContext context = SSLContext.getInstance("TLS");
context.init(null, null, null);
final String[] supportedProtocols = context.getDefaultSSLParameters().getProtocols();
if (Arrays.toString(supportedProtocols).contains("TLSv1.3")) {
System.setProperty("jdk.tls.server.protocols", "TLSv1.3");
System.setProperty("jdk.tls.client.protocols", "TLSv1.3");
}
}

@AfterClass
public static void tearDown() {
System.clearProperty("jdk.tls.server.protocols");
System.clearProperty("jdk.tls.client.protocols");
}

}

0 comments on commit 4c55205

Please sign in to comment.