private EmbeddedChannel createChannel(boolean useSSL) {
    EmbeddedChannel channel = new EmbeddedChannel();
    if (useSSL) {
      SSLEngine sslEngine = SSL_CONTEXT.newEngine(channel.alloc());
      // HttpRequests pass through the SslHandler without a handshake (it only operates on ByteBuffers) so we have
      // to mock certain methods of SSLEngine and SSLSession to ensure that we can test certificate logging.
      SSLEngine mockSSLEngine =
          new MockSSLEngine(sslEngine, new MockSSLSession(sslEngine.getSession(), new Certificate[]{PEER_CERT}));
      channel.pipeline().addLast(new SslHandler(mockSSLEngine));
    }
    channel.pipeline()
        .addLast(new PublicAccessLogHandler(publicAccessLogger, new NettyMetrics(new MetricRegistry())))
        .addLast(new EchoMethodHandler());
    return channel;
  }
Creates an {@link EmbeddedChannel} that incorporates an instance of {@link PublicAccessLogHandler}
and {@link EchoMethodHandler}.
@param useSSL {@code true} to add an {@link SslHandler} to the pipeline.
@return an {@link EmbeddedChannel} that incorporates an instance of {@link PublicAccessLogHandler}
        and {@link EchoMethodHandler}, and an {@link SslHandler} if needed.
ambry-rest/src/test/java/com/github/ambry/rest/PublicAccessLogHandlerTest.java