internal void SendResponse(ChannelRequest request, RpcResponse response)
        {
            MessagePackSerializer<RpcMessage> serializer = _serverContext.SerializationContext.Serializer;

            using (var stream = new MemoryStream())
            {
                var writer = new BinaryWriter(stream);
                writer.Write((byte)0);
                writer.Write((byte)0);
                writer.Write((byte)request.FrameId);
                writer.Write((byte)0);
                writer.Write((int)0); // Dummy value replaced

                int prevPos = (int)stream.Position;
                serializer.Pack(stream, response);
                int bodyLen = (int)stream.Position - prevPos;

                // Set the body len to frame head

                stream.Seek(4, SeekOrigin.Begin);
                writer.Write((int)bodyLen);

                byte[] buffer = stream.GetBuffer();
                _sock.BeginSend(buffer, 0, buffer.Length, SocketFlags.None, OnSend, null);
            }
        }
 public void SendResponse(RpcResponse response)
 {
     _channel.SendResponse(this, response);
 }