SslContextUtil { @VisibleForTesting static Set<String> supportedProtocols(SslContextBuilder builder) { SslContext ctx = null; SSLEngine engine = null; try { ctx = builder.build(); engine = ctx.newEngine(PooledByteBufAllocator.DEFAULT); return ImmutableSet.copyOf(engine.getSupportedProtocols()); } catch (Exception e) { throw new IllegalStateException( "Failed to get the list of supported protocols from an SSLContext.", e); } finally { ReferenceCountUtil.release(engine); ReferenceCountUtil.release(ctx); } } private  SslContextUtil(); static SslContext createSslContext(
            Supplier<SslContextBuilder> builderSupplier, boolean forceHttp1,
            Iterable<? extends Consumer<? super SslContextBuilder>> userCustomizers); static final List<String> DEFAULT_CIPHERS; static final List<String> DEFAULT_PROTOCOLS; }
@Test void openSsl() { assumeThat(Flags.useOpenSsl()).isTrue(); final Set<String> supportedProtocols = SslContextUtil.supportedProtocols( SslContextBuilder.forClient().sslProvider(SslProvider.OPENSSL)); assertThat(supportedProtocols).contains("TLSv1.2", "TLSv1.3"); }
@Test void jdkSsl() { final Set<String> supportedProtocols = SslContextUtil.supportedProtocols( SslContextBuilder.forClient().sslProvider(SslProvider.JDK)); if (SystemInfo.javaVersion() >= 11) { assertThat(supportedProtocols).contains("TLSv1.2", "TLSv1.3"); } else { assertThat(supportedProtocols).contains("TLSv1.2"); } }