@Test
  public void test() throws Exception {
    AtomicReference<org.apache.logging.log4j.Level> level = new AtomicReference<>();
    AtomicReference<String> msg = new AtomicReference<String>();
    doAnswer(new Answer<Void>() {

      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        org.apache.logging.log4j.core.LogEvent logEvent =
          invocation.getArgument(0, org.apache.logging.log4j.core.LogEvent.class);
        level.set(logEvent.getLevel());
        msg.set(logEvent.getMessage().getFormattedMessage());
        return null;
      }
    }).when(mockAppender).append(any());
    ConnectionId id = new ConnectionId(User.getCurrent(), "test",
      Address.fromParts("127.0.0.1", server.getLocalPort()));
    NettyRpcConnection conn = client.createConnection(id);
    BlockingRpcCallback<Call> done = new BlockingRpcCallback<>();
    Call call = new Call(1, ClientMetaService.getDescriptor().getMethods().get(0), null, null, null,
      0, 0, Collections.emptyMap(), done, new CallStats());
    HBaseRpcController hrc = new HBaseRpcControllerImpl();
    conn.sendRequest(call, hrc);
    done.get();
    call.error.printStackTrace();
    assertThat(call.error, instanceOf(NotSslRecordException.class));
    Waiter.waitFor(conf, 5000, () -> msg.get() != null);
    verify(mockAppender).append(any());
    // make sure that it has been logged by BufferCallBeforeInitHandler
    assertEquals(org.apache.logging.log4j.Level.DEBUG, level.get());
    assertThat(msg.get(),
      startsWith("got ssl exception, which should have already been proceeded"));
  }
A simple UT to make sure that we do not leak the SslExceptions to netty's TailContext, where it
will generate a confusing WARN message.
<p>
See HBASE-27782 for more details.
hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestTLSHandshadeFailure.java