public static Jdk9Platform buildIfSupported() { // Find JDK 9 new methods try { Method setProtocolMethod = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); Method getProtocolMethod = SSLSocket.class.getMethod("getApplicationProtocol"); return new Jdk9Platform(setProtocolMethod, getProtocolMethod); } catch (NoSuchMethodException ignored) { // pre JDK 9 } return null; } }
@Override public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols) { try { SSLParameters sslParameters = sslSocket.getSSLParameters(); List<String> names = alpnProtocolNames(protocols); setProtocolMethod.invoke(sslParameters, new Object[] {names.toArray(new String[names.size()])}); sslSocket.setSSLParameters(sslParameters); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError("failed to set SSL parameters", e); } }
/** Attempt to match the host runtime to a capable Platform implementation. */ private static Platform findPlatform() { Platform android = AndroidPlatform.buildIfSupported(); if (android != null) { return android; } if (isConscryptPreferred()) { Platform conscrypt = ConscryptPlatform.buildIfSupported(); if (conscrypt != null) { return conscrypt; } } Platform jdk9 = Jdk9Platform.buildIfSupported(); if (jdk9 != null) { return jdk9; } Platform jdkWithJettyBoot = Jdk8WithJettyBootPlatform.buildIfSupported(); if (jdkWithJettyBoot != null) { return jdkWithJettyBoot; } // Probably an Oracle JDK like OpenJDK. return new Platform(); }
/** Attempt to match the host runtime to a capable Platform implementation. */ private static Platform findPlatform() { Platform android = AndroidPlatform.buildIfSupported(); if (android != null) { return android; } if (isConscryptPreferred()) { Platform conscrypt = ConscryptPlatform.buildIfSupported(); if (conscrypt != null) { return conscrypt; } } Platform jdk9 = Jdk9Platform.buildIfSupported(); if (jdk9 != null) { return jdk9; } Platform jdkWithJettyBoot = Jdk8WithJettyBootPlatform.buildIfSupported(); if (jdkWithJettyBoot != null) { return jdkWithJettyBoot; } // Probably an Oracle JDK like OpenJDK. return new Platform(); }
@Override public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols) { try { SSLParameters sslParameters = sslSocket.getSSLParameters(); List<String> names = alpnProtocolNames(protocols); setProtocolMethod.invoke(sslParameters, new Object[] {names.toArray(new String[names.size()])}); sslSocket.setSSLParameters(sslParameters); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError("failed to set SSL parameters", e); } }
public static Jdk9Platform buildIfSupported() { // Find JDK 9 new methods try { Method setProtocolMethod = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); Method getProtocolMethod = SSLSocket.class.getMethod("getApplicationProtocol"); return new Jdk9Platform(setProtocolMethod, getProtocolMethod); } catch (NoSuchMethodException ignored) { // pre JDK 9 } return null; } }
/** Attempt to match the host runtime to a capable Platform implementation. */ private static Platform findPlatform() { Platform android = AndroidPlatform.buildIfSupported(); if (android != null) { return android; } Platform jdk9 = Jdk9Platform.buildIfSupported(); if (jdk9 != null) { return jdk9; } Platform jdkWithJettyBoot = JdkWithJettyBootPlatform.buildIfSupported(); if (jdkWithJettyBoot != null) { return jdkWithJettyBoot; } // Probably an Oracle JDK like OpenJDK. return new Platform(); }
@Override public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols) { try { SSLParameters sslParameters = sslSocket.getSSLParameters(); List<String> names = alpnProtocolNames(protocols); setProtocolMethod.invoke(sslParameters, new Object[] {names.toArray(new String[names.size()])}); sslSocket.setSSLParameters(sslParameters); } catch (IllegalAccessException | InvocationTargetException e) { throw assertionError("unable to set ssl parameters", e); } }
public static Jdk9Platform buildIfSupported() { // Find JDK 9 new methods try { Method setProtocolMethod = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); Method getProtocolMethod = SSLSocket.class.getMethod("getApplicationProtocol"); return new Jdk9Platform(setProtocolMethod, getProtocolMethod); } catch (NoSuchMethodException ignored) { // pre JDK 9 } return null; } }
/** Attempt to match the host runtime to a capable Platform implementation. */ private static Platform findPlatform() { Platform android = AndroidPlatform.buildIfSupported(); if (android != null) { return android; } if (isConscryptPreferred()) { Platform conscrypt = ConscryptPlatform.buildIfSupported(); if (conscrypt != null) { return conscrypt; } } Platform jdk9 = Jdk9Platform.buildIfSupported(); if (jdk9 != null) { return jdk9; } Platform jdkWithJettyBoot = JdkWithJettyBootPlatform.buildIfSupported(); if (jdkWithJettyBoot != null) { return jdkWithJettyBoot; } // Probably an Oracle JDK like OpenJDK. return new Platform(); }
@Override public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols) { try { SSLParameters sslParameters = sslSocket.getSSLParameters(); List<String> names = alpnProtocolNames(protocols); setProtocolMethod.invoke(sslParameters, new Object[] {names.toArray(new String[names.size()])}); sslSocket.setSSLParameters(sslParameters); } catch (IllegalAccessException | InvocationTargetException e) { throw assertionError("unable to set ssl parameters", e); } }
public static Jdk9Platform buildIfSupported() { // Find JDK 9 new methods try { Method setProtocolMethod = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); Method getProtocolMethod = SSLSocket.class.getMethod("getApplicationProtocol"); return new Jdk9Platform(setProtocolMethod, getProtocolMethod); } catch (NoSuchMethodException ignored) { // pre JDK 9 } return null; } }