ProtoUtil { public static RpcRequestHeaderProto makeRpcRequestHeader(RPC.RpcKind rpcKind, RpcRequestHeaderProto.OperationProto operation, int callId, int retryCount, byte[] uuid) { RpcRequestHeaderProto.Builder result = RpcRequestHeaderProto.newBuilder(); result.setRpcKind(convert(rpcKind)).setRpcOp(operation).setCallId(callId) .setRetryCount(retryCount).setClientId(ByteString.copyFrom(uuid)); Span span = Tracer.getCurrentSpan(); if (span != null) { result.setTraceInfo(RPCTraceInfoProto.newBuilder() .setTraceId(span.getSpanId().getHigh()) .setParentId(span.getSpanId().getLow()) .build()); } CallerContext callerContext = CallerContext.getCurrent(); if (callerContext != null && callerContext.isContextValid()) { RPCCallerContextProto.Builder contextBuilder = RPCCallerContextProto .newBuilder().setContext(callerContext.getContext()); if (callerContext.getSignature() != null) { contextBuilder.setSignature( ByteString.copyFrom(callerContext.getSignature())); } result.setCallerContext(contextBuilder); } return result.build(); }  static int readRawVarint32(DataInput in); static IpcConnectionContextProto makeIpcConnectionContext(
      final String protocol,
      final UserGroupInformation ugi, final AuthMethod authMethod); static UserGroupInformation getUgi(IpcConnectionContextProto context); static UserGroupInformation getUgi(UserInformationProto userInfo); static RPC.RpcKind convert( RpcKindProto kind); static RpcRequestHeaderProto makeRpcRequestHeader(RPC.RpcKind rpcKind,
      RpcRequestHeaderProto.OperationProto operation, int callId,
      int retryCount, byte[] uuid);  }
@Test public void testRpcClientId() { byte[] uuid = ClientId.getClientId(); RpcRequestHeaderProto header = ProtoUtil.makeRpcRequestHeader( RpcKind.RPC_PROTOCOL_BUFFER, OperationProto.RPC_FINAL_PACKET, 0, RpcConstants.INVALID_RETRY_COUNT, uuid); assertTrue(Arrays.equals(uuid, header.getClientId().toByteArray())); }