/**
  * Sends {bytesToSend} via {@link #echoClient} and validates echo response if {@link
  * validateResponse} is {@code true}.
  *
  * @param bytesToSend Bytes to send via {@link #echoClient}.
  * @param executorService {@link ExecutorService} to use to handle result of the {@link
  *     TcpSequentialClient#send(TcpMessage)} method.
  * @return {@link CompletionStage} that represents success ({@code true}) or failure ({@code
  *     false}) of validation of echo response.
  */
 private final CompletionStage<Boolean> echo(
     final byte[] bytesToSend, final ExecutorService executorService) {
   final CompletionStage<Optional<TcpResponse<byte[]>>> echoResponse =
       echoClient.send(new TcpMessage<>(bytesToSend, echoResponseTimeoutMillis));
   return echoResponse.thenApplyAsync(
       (response) -> {
         final TcpResponse<byte[]> tcpResponse = response.get();
         final byte[] respondedBytes = tcpResponse.get();
         final Boolean result =
             validateResponse ? Arrays.equals(bytesToSend, respondedBytes) : TRUE;
         if (!result) {
           tcpResponse.abort();
         }
         return result;
       },
       executorService);
 }
 /**
  * Shuts down {@link TcpSequentialClient} that was specified to construct this {@link
  * EchoUtf8StringRestRequestHandler}.
  */
 @Override
 protected final void shutdownHook() {
   echoClient.shutdown();
 }