public override void InitiateHandshake(LinkSession session)
        {
            if (ReferenceEquals(BufferTransform, null))
            {
                return;
            }

            var sessionStrategy =
                (BufferTransformSessionStrategy)session.ChannelStrategy;

            var bufferTransform = (IBufferTransform)BufferTransform.Clone();
            sessionStrategy.BufferTransform = bufferTransform;
            SignalPool.Acquire(session.InternalHandle).Set();

            session.Send(new HandshakeReq {
                _Transform = false,
                Data = bufferTransform.InitializeHandshake()
            });
        }
        public override bool Process(Event e)
        {
            switch (e.GetTypeId())
            {
                case (int)LinkEventType.HandshakeReq:
                    {
                        var req = (HandshakeReq)e;
                        var resp = new HandshakeResp { _Transform = false };
                        byte[] response = null;
                        try
                        {
                            ManualResetEvent waitHandle =
                                SignalPool.Acquire(Session.InternalHandle);
                            waitHandle.WaitOne(new TimeSpan(0, 0, 30));
                            SignalPool.Release(Session.InternalHandle);
                            response = BufferTransform.Handshake(req.Data);
                        }
                        catch (Exception ex)
                        {
                            Trace.Error("{0} {1} error handshaking : {2}",
                                Session.Link.Name, Session.InternalHandle, ex.ToString());
                        }
                        if (response != null)
                        {
                            resp.Data = response;
                        }
                        Session.Send(resp);
                    }
                    break;
                case (int)LinkEventType.HandshakeResp:
                    {
                        var ack = new HandshakeAck { _Transform = false };
                        var resp = (HandshakeResp)e;
                        try
                        {
                            if (BufferTransform.FinalizeHandshake(resp.Data))
                            {
                                rxTransformReady = true;
                                ack.Result = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            Trace.Error("{0} {1} error finishing handshake : {2}",
                                Session.Link.Name, Session.InternalHandle, ex.ToString());
                        }
                        Session.Send(ack);
                    }
                    break;
                case (int)LinkEventType.HandshakeAck:
                    {
                        var ack = (HandshakeAck)e;
                        bool result = ack.Result;

                        if (result)
                        {
                            txTransformReady = true;
                        }

                        Session.Link.OnLinkSessionConnectedInternal(result, (result ? Session: null));
                    }
                    break;
                default:
                    return false;
            }
            return true;
        }