@CanIgnoreReturnValue
  public static SslContextBuilder configure(SslContextBuilder builder, Provider jdkProvider) {
    ApplicationProtocolConfig apc;
    if (SUN_PROVIDER_NAME.equals(jdkProvider.getName())) {
      // Jetty ALPN/NPN only supports one of NPN or ALPN
      if (JettyTlsUtil.isJettyAlpnConfigured()) {
        apc = ALPN;
      } else if (JettyTlsUtil.isJettyNpnConfigured()) {
        apc = NPN;
      } else if (JettyTlsUtil.isJava9AlpnAvailable()) {
        apc = ALPN;
      } else {
        throw new IllegalArgumentException(
            SUN_PROVIDER_NAME + " selected, but Jetty NPN/ALPN unavailable");
      }
    } else if (isConscrypt(jdkProvider)) {
      apc = ALPN;
    } else {
      throw new IllegalArgumentException("Unknown provider; can't configure: " + jdkProvider);
    }
    return builder
        .sslProvider(SslProvider.JDK)
        .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
        .applicationProtocolConfig(apc)
        .sslContextProvider(jdkProvider);
  }
@ CanIgnoreReturnValue public static SslContextBuilder configure ( SslContextBuilder builder , Provider jdkProvider ) { ApplicationProtocolConfig apc ; if ( SUN_PROVIDER_NAME . equals ( jdkProvider . getName ( ) ) ) { if ( JettyTlsUtil . isJettyAlpnConfigured ( ) ) { apc = ALPN ; } else if ( JettyTlsUtil . isJettyNpnConfigured ( ) ) { apc = NPN ; } else if ( JettyTlsUtil . isJava9AlpnAvailable ( ) ) { apc = ALPN ; } else { throw new IllegalArgumentException ( SUN_PROVIDER_NAME + " selected, but Jetty NPN/ALPN unavailable" ) ; } } else if ( isConscrypt ( jdkProvider ) ) { apc = ALPN ; } else { throw new IllegalArgumentException ( "Unknown provider; can't configure: " + jdkProvider ) ; } return builder . sslProvider ( SslProvider . JDK ) . ciphers ( Http2SecurityUtil . CIPHERS , SupportedCipherSuiteFilter . INSTANCE ) . applicationProtocolConfig ( apc ) . sslContextProvider ( jdkProvider ) ; }
Set ciphers and APN appropriate for gRPC. Precisely what is set is permitted to change, so if
an application requires particular settings it should override the options set here.