public static <T> GenericFutureListener<Future<T>> promiseNotifyingListener(Promise<T> channelPromise) {
    return future -> {
      if (future.isSuccess()) {
        channelPromise.setSuccess(future.getNow());
      } else {
        channelPromise.setFailure(future.cause());
      }
    };
  }
Create a {@link GenericFutureListener} that will notify the provided {@link Promise} on success and failure.

@param channelPromise Promise to notify.
@return GenericFutureListener
ambry-commons/src/main/java/com/github/ambry/commons/NettyUtils.java