@Override
  public SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode) {
    SslContext context = mode == Mode.CLIENT ? nettyClientSslContext : nettyServerSslContext;
    SSLEngine sslEngine = context.newEngine(ByteBufAllocator.DEFAULT, peerHost, peerPort);

    if (mode == Mode.CLIENT) {
      SSLParameters sslParams = sslEngine.getSSLParameters();
      sslParams.setEndpointIdentificationAlgorithm(endpointIdentification);
      sslEngine.setSSLParameters(sslParams);
    }
    if (logger.isTraceEnabled()) {
      String[] supportedProtocols = sslEngine.getSupportedProtocols();
      String[] enabledProtocols = sslEngine.getEnabledProtocols();
      logger.trace("NettySslHttp2Factory creating SSLEngine for {}: supportedProtocols: {}, enabledProtocols: {}",
          mode.name(), String.join(",", supportedProtocols), String.join(",", enabledProtocols));
    }
    return sslEngine;
  }
Instantiate a {@link NettySslFactory} from a config.
@param sslConfig the {@link SSLConfig} to use.
@throws GeneralSecurityException
@throws IOException
ambry-commons/src/main/java/com/github/ambry/commons/NettySslHttp2Factory.java