public static SslContext getClientSslContext(SSLConfig config) throws GeneralSecurityException, IOException {
    logger.info("Using {} provider for client ", SslContext.defaultClientProvider());
    SslContextBuilder sslContextBuilder;
    if (config.sslHttp2SelfSign) {
      // Both server and client should use InsecureTrustManage for self-sign case.
      SelfSignedCertificate ssc = new SelfSignedCertificate();
      sslContextBuilder = SslContextBuilder.forClient()
          .keyManager(ssc.certificate(), ssc.privateKey())
          .trustManager(InsecureTrustManagerFactory.INSTANCE);
      logger.info("Client Uses Self Signed Certificate.");
    } else {
      sslContextBuilder = SslContextBuilder.forClient()
          .keyManager(NettySslFactory.getKeyManagerFactory(config))
          .trustManager(NettySslFactory.getTrustManagerFactory(config));
    }
    return sslContextBuilder.sslProvider(SslContext.defaultClientProvider())
        /* NOTE: the cipher filter may not include all ciphers required by the HTTP/2 specification.
         * Please refer to the HTTP/2 specification for cipher requirements. */.ciphers(Http2SecurityUtil.CIPHERS,
            SupportedCipherSuiteFilter.INSTANCE)
        .applicationProtocolConfig(new ApplicationProtocolConfig(ApplicationProtocolConfig.Protocol.ALPN,
            // NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
            ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
            // ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
            ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2))
        .build();
  }
@param config the {@link SSLConfig}
@return a configured {@link SslContext} object for a server.
@throws GeneralSecurityException
@throws IOException
ambry-commons/src/main/java/com/github/ambry/commons/NettySslHttp2Factory.java