@Override
  public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
    if (msg instanceof Call) {
      Call call = (Call) msg;
      id2Call.put(call.id, call);
      // The call is already in track so here we set the write operation as success.
      // We will fail the call directly if we can not write it out.
      promise.trySuccess();
    } else {
      ctx.write(msg, promise);
    }
  }
We will expose the connection to upper layer before initialized, so we need to buffer the calls
passed in and write them out once the connection is established.
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BufferCallBeforeInitHandler.java