private <T extends InputStream & DataInput> void finishCall(ResponseHeader responseHeader, T in,
    Call call) throws IOException {
    Message value;
    if (call.responseDefaultType != null) {
      Message.Builder builder = call.responseDefaultType.newBuilderForType();
      if (!builder.mergeDelimitedFrom(in)) {
        // The javadoc of mergeDelimitedFrom says returning false means the stream reaches EOF
        // before reading any bytes out, so here we need to manually finish create the EOFException
        // and finish the call
        call.setException(new EOFException("EOF while reading response with type: "
          + call.responseDefaultType.getClass().getName()));
        return;
      }
      value = builder.build();
    } else {
      value = null;
    }
    ExtendedCellScanner cellBlockScanner;
    if (responseHeader.hasCellBlockMeta()) {
      int size = responseHeader.getCellBlockMeta().getLength();
      // Maybe we could read directly from the ByteBuf.
      // The problem here is that we do not know when to release it.
      byte[] cellBlock = new byte[size];
      in.readFully(cellBlock);
      cellBlockScanner = cellBlockBuilder.createCellScanner(this.codec, this.compressor, cellBlock);
    } else {
      cellBlockScanner = null;
    }
    call.setResponse(value, cellBlockScanner);
  }
Does the clean up work after the connection is removed from the connection pool
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcConnection.java