public void ReceiveRequest()
        {
            // Seems like this method is invoked to send a reply
            // with related to "already created" SOAP fault.
            //
            // It is still not understandable that this delegate
            // is invoked as an infinite loop ...
            ReplyHandler handler = delegate(Message input) {
                Console.Error.WriteLine("Processing a reply.");
                // a:InvalidSecurity
                // An error occurred when verifying security for the message.
                Assert.IsTrue(input.IsFault);
                throw new ApplicationException();
            };
            Message         msg      = Message.CreateMessage(MessageVersion.Default, "myAction");
            RequestReceiver receiver = delegate() {
                return(msg);
            };
            IChannelListener <IReplyChannel> listener = CreateListener(handler, receiver);

            listener.Open();
            IReplyChannel reply = listener.AcceptChannel();

            reply.Open();
            RequestContext ctx = reply.EndReceiveRequest(reply.BeginReceiveRequest(null, null));
        }
        public void FullRequest()
        {
            EndpointIdentity identity =
                new X509CertificateEndpointIdentity(new X509Certificate2("Test/Resources/test.pfx", "mono"));
            EndpointAddress address =
                new EndpointAddress(new Uri("stream:dummy"), identity);

            Message mreq   = Message.CreateMessage(MessageVersion.Default, "myAction");
            Message mreply = null;

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;

            // listener setup
            ReplyHandler replyHandler = delegate(Message rinput)
            {
                mreply = rinput;
            };
            RequestReceiver receiver = delegate()
            {
                return(mreq);
            };
            IChannelListener <IReplyChannel> listener = CreateListener(replyHandler, receiver);

            listener.Open();
            IReplyChannel reply = listener.AcceptChannel();

            reply.Open();

            RequestSender reqHandler = delegate(Message input)
            {
                try
                {
                    // sync version somehow causes an infinite loop (!?)
                    RequestContext ctx = reply.EndReceiveRequest(reply.BeginReceiveRequest(TimeSpan.FromSeconds(5), null, null));
//					RequestContext ctx = reply.ReceiveRequest (TimeSpan.FromSeconds (5));
                    Console.Error.WriteLine("Acquired RequestContext.");
                    ctx.Reply(input);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("ERROR during processing a request in FullRequest()");
                    Console.Error.WriteLine(ex);
                    Console.Error.Flush();
                    throw;
                }
                return(mreply);
            };
            CustomBinding b = CreateBinding(reqHandler);

            IRequestChannel ch = ChannelFactory <IRequestChannel> .CreateChannel(b, address);

            ch.Open();
            Console.Error.WriteLine("**** starting a request  ****");
            IAsyncResult async = ch.BeginRequest(mreq, null, null);

            Console.Error.WriteLine("**** request started. ****");
            Message res = ch.EndRequest(async);
        }
Exemple #3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            //start the messsage handlers:
            NewMailHandler.Init();
            ReplyHandler.Init();
        }
Exemple #4
0
	/**
	*常驻内存属性模块-->同步背包数据 RPC请求
	*/
	public void SyncData(ReplyHandler replyCB)
	{
		PersistAttrRpcSyncDataAskWraper askPBWraper = new PersistAttrRpcSyncDataAskWraper();
		ModMessage askMsg = new ModMessage();
		askMsg.MsgNum = RPC_CODE_PERSISTATTR_SYNCDATA_REQUEST;
		askMsg.protoMS = askPBWraper.ToMemoryStream();

		Singleton<GameSocket>.Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
			PersistAttrRpcSyncDataReplyWraper replyPBWraper = new PersistAttrRpcSyncDataReplyWraper();
			replyPBWraper.FromMemoryStream(replyMsg.protoMS);
			replyCB(replyPBWraper);
		});
	}
Exemple #5
0
    /**
     *活动 风暴-->取消进入战场 RPC请求
     */
    public void CanceInsertBattle(ReplyHandler replyCB)
    {
        ActivityStormRpcCanceInsertBattleAskWraper askPBWraper = new ActivityStormRpcCanceInsertBattleAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_ACTIVITYSTORM_CANCEINSERTBATTLE_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            ActivityStormRpcCanceInsertBattleReplyWraper replyPBWraper = new ActivityStormRpcCanceInsertBattleReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #6
0
    /**
     *活动 风暴-->同步数据 RPC请求
     */
    public void SyncData(ReplyHandler replyCB)
    {
        ActivityStormRpcSyncDataAskWraper askPBWraper = new ActivityStormRpcSyncDataAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_ACTIVITYSTORM_SYNCDATA_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            ActivityStormRpcSyncDataReplyWraper replyPBWraper = new ActivityStormRpcSyncDataReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #7
0
    /**
     *战斗-->Kernel映像 RPC请求
     */
    public void KernelMapping(ReplyHandler replyCB)
    {
        FightRpcKernelMappingAskWraper askPBWraper = new FightRpcKernelMappingAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_FIGHT_KERNELMAPPING_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            FightRpcKernelMappingReplyWraper replyPBWraper = new FightRpcKernelMappingReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #8
0
    /**
     *帮派-->进入帮会战 RPC请求
     */
    public void EnterGuildWar(ReplyHandler replyCB)
    {
        GuildRpcEnterGuildWarAskWraper askPBWraper = new GuildRpcEnterGuildWarAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_GUILD_ENTERGUILDWAR_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            GuildRpcEnterGuildWarReplyWraper replyPBWraper = new GuildRpcEnterGuildWarReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #9
0
    /**
     *帮派-->辞职 RPC请求
     */
    public void ResignDuty(ReplyHandler replyCB)
    {
        GuildRpcResignDutyAskWraper askPBWraper = new GuildRpcResignDutyAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_GUILD_RESIGNDUTY_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            GuildRpcResignDutyReplyWraper replyPBWraper = new GuildRpcResignDutyReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #10
0
    /**
     *组队-->清空申请列表 RPC请求
     */
    public void ClearApplyList(ReplyHandler replyCB)
    {
        TeamRpcClearApplyListAskWraper askPBWraper = new TeamRpcClearApplyListAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_TEAM_CLEARAPPLYLIST_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            TeamRpcClearApplyListReplyWraper replyPBWraper = new TeamRpcClearApplyListReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #11
0
    /**
     *组队-->跟随 RPC请求
     */
    public void Follow(ReplyHandler replyCB)
    {
        TeamRpcFollowAskWraper askPBWraper = new TeamRpcFollowAskWraper();
        ModMessage             askMsg      = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_TEAM_FOLLOW_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            TeamRpcFollowReplyWraper replyPBWraper = new TeamRpcFollowReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #12
0
    /**
     *邮件-->一键领取 RPC请求
     */
    public void OneKeyGetReward(ReplyHandler replyCB)
    {
        MailRpcOneKeyGetRewardAskWraper askPBWraper = new MailRpcOneKeyGetRewardAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_MAIL_ONEKEYGETREWARD_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            MailRpcOneKeyGetRewardReplyWraper replyPBWraper = new MailRpcOneKeyGetRewardReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #13
0
    /**
     *技能-->天赋重置 RPC请求
     */
    public void TalentReset(ReplyHandler replyCB)
    {
        SkillRpcTalentResetAskWraper askPBWraper = new SkillRpcTalentResetAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_SKILL_TALENTRESET_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            SkillRpcTalentResetReplyWraper replyPBWraper = new SkillRpcTalentResetReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #14
0
    /**
     *货运-->起航请求 RPC请求
     */
    public void SetSail(ReplyHandler replyCB)
    {
        TransportRpcSetSailAskWraper askPBWraper = new TransportRpcSetSailAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_TRANSPORT_SETSAIL_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            TransportRpcSetSailReplyWraper replyPBWraper = new TransportRpcSetSailReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #15
0
    /**
     *战斗-->zou RPC请求
     */
    public void Move(ReplyHandler replyCB)
    {
        ZhanDouRpcMoveAskWraper askPBWraper = new ZhanDouRpcMoveAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_ZHANDOU_MOVE_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            ZhanDouRpcMoveReplyWraper replyPBWraper = new ZhanDouRpcMoveReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #16
0
    /**
     *英雄-->武圣升级 RPC请求
     */
    public void WuShengLvUp(ReplyHandler replyCB)
    {
        HeroRpcWuShengLvUpAskWraper askPBWraper = new HeroRpcWuShengLvUpAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_HERO_WUSHENGLVUP_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            HeroRpcWuShengLvUpReplyWraper replyPBWraper = new HeroRpcWuShengLvUpReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #17
0
    /**
     *英雄-->技能点计时 RPC请求
     */
    public void SkillTime(ReplyHandler replyCB)
    {
        HeroRpcSkillTimeAskWraper askPBWraper = new HeroRpcSkillTimeAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_HERO_SKILLTIME_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            HeroRpcSkillTimeReplyWraper replyPBWraper = new HeroRpcSkillTimeReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #18
0
    /**
     *帮派-->帮会练武堂升级 RPC请求
     */
    public void KongfuHallLvUp(ReplyHandler replyCB)
    {
        GuildRpcKongfuHallLvUpAskWraper askPBWraper = new GuildRpcKongfuHallLvUpAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_GUILD_KONGFUHALLLVUP_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            GuildRpcKongfuHallLvUpReplyWraper replyPBWraper = new GuildRpcKongfuHallLvUpReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
    /**
     *活动日常-->世界Boss进行副本 RPC请求
     */
    public void WorldBossEnterDungeon(ReplyHandler replyCB)
    {
        ActivityScheduleRpcWorldBossEnterDungeonAskWraper askPBWraper = new ActivityScheduleRpcWorldBossEnterDungeonAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_ACTIVITYSCHEDULE_WORLDBOSSENTERDUNGEON_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            ActivityScheduleRpcWorldBossEnterDungeonReplyWraper replyPBWraper = new ActivityScheduleRpcWorldBossEnterDungeonReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #20
0
    /**
     *战队基础数据-->提升官阶 RPC请求
     */
    public void UpGradeRank(ReplyHandler replyCB)
    {
        BaseAttrRpcUpGradeRankAskWraper askPBWraper = new BaseAttrRpcUpGradeRankAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_BASEATTR_UPGRADERANK_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            BaseAttrRpcUpGradeRankReplyWraper replyPBWraper = new BaseAttrRpcUpGradeRankReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
    /**
     *神器-->宝石合成 RPC请求
     */
    public void Compound(ReplyHandler replyCB)
    {
        GodWeaponRpcCompoundAskWraper askPBWraper = new GodWeaponRpcCompoundAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_GODWEAPON_COMPOUND_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            GodWeaponRpcCompoundReplyWraper replyPBWraper = new GodWeaponRpcCompoundReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
        CustomBinding CreateBinding(ReplyHandler replier, RequestReceiver receiver)
        {
            SymmetricSecurityBindingElement sbe =
                new SymmetricSecurityBindingElement();

            sbe.ProtectionTokenParameters =
                new X509SecurityTokenParameters();
            CustomBinding b = new CustomBinding(
                sbe,
                new TextMessageEncodingBindingElement(),
                new HandlerTransportBindingElement(replier, receiver));

            return(b);
        }
Exemple #23
0
    /**
     *活动 大逃杀-->报名进入 RPC请求
     */
    public void SignUp(ReplyHandler replyCB)
    {
        ActivityEscapeRpcSignUpAskWraper askPBWraper = new ActivityEscapeRpcSignUpAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_ACTIVITYESCAPE_SIGNUP_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            ActivityEscapeRpcSignUpReplyWraper replyPBWraper = new ActivityEscapeRpcSignUpReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #24
0
    /**
     *任务-->开始帮会刺探 RPC请求
     */
    public void StartGuildSpy(ReplyHandler replyCB)
    {
        TaskRpcStartGuildSpyAskWraper askPBWraper = new TaskRpcStartGuildSpyAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_TASK_STARTGUILDSPY_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            TaskRpcStartGuildSpyReplyWraper replyPBWraper = new TaskRpcStartGuildSpyReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #25
0
    /**
     *好友-->每次打开界面,请求一次数据 RPC请求
     */
    public void SyncFriendData(ReplyHandler replyCB)
    {
        FriendRpcSyncFriendDataAskWraper askPBWraper = new FriendRpcSyncFriendDataAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_FRIEND_SYNCFRIENDDATA_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            FriendRpcSyncFriendDataReplyWraper replyPBWraper = new FriendRpcSyncFriendDataReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #26
0
    /**
     *一v一-->获得攻守的信息 RPC请求
     */
    public void GetActMessage(ReplyHandler replyCB)
    {
        OneVSOneRpcGetActMessageAskWraper askPBWraper = new OneVSOneRpcGetActMessageAskWraper();
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_ONEVSONE_GETACTMESSAGE_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            OneVSOneRpcGetActMessageReplyWraper replyPBWraper = new OneVSOneRpcGetActMessageReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #27
0
    /**
     * GM指令-->指令动作 RPC请求
     */
    public void Action(string Value, ReplyHandler replyCB)
    {
        GMRpcActionAskWraper askPBWraper = new GMRpcActionAskWraper();

        askPBWraper.Value = Value;
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_GM_ACTION_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            GMRpcActionReplyWraper replyPBWraper = new GMRpcActionReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #28
0
    /**
     * 商城-->刷新道具 RPC请求
     */
    public void RefreshItem(int ShopType, ReplyHandler replyCB)
    {
        ShopRpcRefreshItemAskWraper askPBWraper = new ShopRpcRefreshItemAskWraper();

        askPBWraper.ShopType = ShopType;
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_SHOP_REFRESHITEM_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            ShopRpcRefreshItemReplyWraper replyPBWraper = new ShopRpcRefreshItemReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #29
0
    /**
     *好友-->增加好友 RPC请求
     */
    public void AddFriend(long UserId, ReplyHandler replyCB)
    {
        FriendRpcAddFriendAskWraper askPBWraper = new FriendRpcAddFriendAskWraper();

        askPBWraper.UserId = UserId;
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_FRIEND_ADDFRIEND_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            FriendRpcAddFriendReplyWraper replyPBWraper = new FriendRpcAddFriendReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
Exemple #30
0
    /**
     *好友-->查看资料简单数据 RPC请求
     */
    public void ViewUserSimpleInfo(long UserId, ReplyHandler replyCB)
    {
        FriendRpcViewUserSimpleInfoAskWraper askPBWraper = new FriendRpcViewUserSimpleInfoAskWraper();

        askPBWraper.UserId = UserId;
        ModMessage askMsg = new ModMessage();

        askMsg.MsgNum  = RPC_CODE_FRIEND_VIEWUSERSIMPLEINFO_REQUEST;
        askMsg.protoMS = askPBWraper.ToMemoryStream();

        Singleton <GameSocket> .Instance.SendAsk(askMsg, delegate(ModMessage replyMsg){
            FriendRpcViewUserSimpleInfoReplyWraper replyPBWraper = new FriendRpcViewUserSimpleInfoReplyWraper();
            replyPBWraper.FromMemoryStream(replyMsg.protoMS);
            replyCB(replyPBWraper);
        });
    }
		IChannelListener<IReplyChannel> CreateListener (ReplyHandler handler, RequestReceiver receiver)
		{
			CustomBinding rb = CreateBinding (handler, receiver);
			BindingParameterCollection bpl =
				new BindingParameterCollection ();
			ServiceCredentials cred = new ServiceCredentials ();
			cred.ServiceCertificate.Certificate =
				new X509Certificate2 ("Test/Resources/test.pfx", "mono");
			IServiceBehavior sb = cred;
			sb.AddBindingParameters (null, null, null, bpl);
			IChannelListener<IReplyChannel> listener = rb.BuildChannelListener<IReplyChannel> (bpl);
			return listener;
		}
		CustomBinding CreateBinding (ReplyHandler replier, RequestReceiver receiver)
		{
			SymmetricSecurityBindingElement sbe =
				new SymmetricSecurityBindingElement ();
			sbe.ProtectionTokenParameters =
				new X509SecurityTokenParameters ();
			CustomBinding b = new CustomBinding (
				sbe,
				new TextMessageEncodingBindingElement (),
				new HandlerTransportBindingElement (replier, receiver));
			return b;
		}