public void Test1()
        {
            var frameInital = new SaiTtsFrameEstimate();

            frameInital.SequenceNo                = 100;
            frameInital.SenderTimestamp           = 1000;
            frameInital.SenderLastRecvTimestamp   = 900;
            frameInital.ReceiverLastSendTimestamp = 800;
            frameInital.OffsetMax = -3000;
            frameInital.OffsetMin = -3100;

            var bytes = frameInital.GetBytes();

            var actual = SaiFrame.Parse(bytes) as SaiTtsFrameEstimate;

            Assert.AreEqual(frameInital.FrameType, actual.FrameType);
            Assert.AreEqual(frameInital.SequenceNo, actual.SequenceNo);
            Assert.AreEqual(frameInital.SenderTimestamp, actual.SenderTimestamp);
            Assert.AreEqual(frameInital.SenderLastRecvTimestamp, actual.SenderLastRecvTimestamp);
            Assert.AreEqual(frameInital.ReceiverLastSendTimestamp, actual.ReceiverLastSendTimestamp);
            Assert.AreEqual(frameInital.OffsetMax, actual.OffsetMax);
            Assert.AreEqual(frameInital.OffsetMin, actual.OffsetMin);
        }
        protected override void HandleTtsOffsetAnswer2Frame(Frames.SaiTtsFrameOffsetAnswer2 answer2)
        {
            // 收到Answer2,停止计时器
            this.Context.StopHandshakeTimer();
            LogUtility.Info(string.Format("{0}: 收到OffsetAnswer2报文,停止Tres_start计时器。",
                                          this.Context.RsspEP.ID));

            // 更新时间戳
            this.Calculator.ResTimestamp3  = this.TTS.LocalLastRecvTimeStamp;
            this.Calculator.InitTimestamp2 = answer2.SenderLastRecvTimestamp;
            this.Calculator.InitTimestamp3 = answer2.SenderTimestamp;

            // 应答方计算时钟偏移
            this.Calculator.EstimateResOffset();
            LogUtility.Info(string.Format("{0}: 应答方估算的时钟偏移,OffsetMin = {1}, OffsetMax = {2}",
                                          this.Context.RsspEP.ID, this.Calculator.ResMinOffset, this.Calculator.ResMaxOffset));


            // 发送OffsetEst
            var seq           = (ushort)this.Context.SeqNoManager.GetAndUpdateSendSeq();
            var estimateFrame = new SaiTtsFrameEstimate(seq,
                                                        TripleTimestamp.CurrentTimestamp, TTS.RemoteLastSendTimestamp, TTS.LocalLastRecvTimeStamp,
                                                        this.Calculator.ResMinOffset,
                                                        this.Calculator.ResMaxOffset);

            this.Context.NextLayer.SendUserData(estimateFrame.GetBytes());
            LogUtility.Info(string.Format("{0}: 发送OffsetEst。", this.Context.RsspEP.ID));


            // 启动计时器,等待OffsetEnd报文。
            LogUtility.Info(string.Format("{0}: 启动计时器,等待OffsetEnd报文。",
                                          this.Context.RsspEP.ID));
            this.Context.StartHandshakeTimer();

            // 更新状态。
            this.Context.CurrentState = new TtsWaitingforEndState(this);
        }