Exemplo n.º 1
0
 public virtual void TestRpcClientId()
 {
     byte[] uuid = ClientId.GetClientId();
     RpcHeaderProtos.RpcRequestHeaderProto header = ProtoUtil.MakeRpcRequestHeader(RPC.RpcKind
                                                                                   .RpcProtocolBuffer, RpcHeaderProtos.RpcRequestHeaderProto.OperationProto.RpcFinalPacket
                                                                                   , 0, RpcConstants.InvalidRetryCount, uuid);
     Assert.True(Arrays.Equals(uuid, header.GetClientId().ToByteArray
                                   ()));
 }
Exemplo n.º 2
0
        /// <exception cref="System.IO.IOException"/>
        private void DoVarIntTest(int value)
        {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            CodedOutputStream     cout = CodedOutputStream.NewInstance(baos);

            cout.WriteRawVarint32(value);
            cout.Flush();
            DataInputStream dis = new DataInputStream(new ByteArrayInputStream(baos.ToByteArray
                                                                                   ()));

            Assert.Equal(value, ProtoUtil.ReadRawVarint32(dis));
        }