Exemplo n.º 1
0
        public virtual void TestPipeLineAckCompatibility()
        {
            DataTransferProtos.PipelineAckProto proto = ((DataTransferProtos.PipelineAckProto
                                                          )DataTransferProtos.PipelineAckProto.NewBuilder().SetSeqno(0).AddReply(DataTransferProtos.Status
                                                                                                                                 .ChecksumOk).Build());
            DataTransferProtos.PipelineAckProto newProto = ((DataTransferProtos.PipelineAckProto
                                                             )DataTransferProtos.PipelineAckProto.NewBuilder().MergeFrom(proto).AddFlag(PipelineAck
                                                                                                                                        .CombineHeader(PipelineAck.ECN.Supported, DataTransferProtos.Status.ChecksumOk))
                                                            .Build());
            ByteArrayOutputStream oldAckBytes = new ByteArrayOutputStream();

            proto.WriteDelimitedTo(oldAckBytes);
            PipelineAck oldAck = new PipelineAck();

            oldAck.ReadFields(new ByteArrayInputStream(oldAckBytes.ToByteArray()));
            NUnit.Framework.Assert.AreEqual(PipelineAck.CombineHeader(PipelineAck.ECN.Disabled
                                                                      , DataTransferProtos.Status.ChecksumOk), oldAck.GetHeaderFlag(0));
            PipelineAck           newAck      = new PipelineAck();
            ByteArrayOutputStream newAckBytes = new ByteArrayOutputStream();

            newProto.WriteDelimitedTo(newAckBytes);
            newAck.ReadFields(new ByteArrayInputStream(newAckBytes.ToByteArray()));
            NUnit.Framework.Assert.AreEqual(PipelineAck.CombineHeader(PipelineAck.ECN.Supported
                                                                      , DataTransferProtos.Status.ChecksumOk), newAck.GetHeaderFlag(0));
        }
Exemplo n.º 2
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Write(OutputStream @out)
 {
     proto.WriteDelimitedTo(@out);
 }