/// <summary>
        /// 外部创建通信代理对象
        /// </summary>
        /// <param name="RemoteAddress">远程地址,如"net.tcp://localhost:12005/MachineService"</param>
        /// <returns></returns>
        public static PartnerProxy Create(string RemoteAddress)
        {
            EndpointAddress edpTcp = new EndpointAddress(RemoteAddress);

            // 创建Binding
            NetTcpBinding myBinding = new NetTcpBinding();

            myBinding.Security.Mode = SecurityMode.None;
            //myBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
            //myBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
            PartnerProxy client = new PartnerProxy(myBinding, edpTcp);

            return(client);
        }
        public void StartConnect()
        {
            if (Connected)
            {
                return;
            }

            // 创建
            switch (HostType)
            {
            case HostConnectionType.Machine:
                ConnectionInstance = MachineProxy.Create(RemoteHostAddress);
                break;

            case HostConnectionType.Process:
                ConnectionInstance = ProcessProxy.Create(RemoteHostAddress);
                break;

            case HostConnectionType.Resource:
                ConnectionInstance = ResourceProxy.Create(RemoteHostAddress);
                break;

            case HostConnectionType.Partner:
                ConnectionInstance = PartnerProxy.Create(RemoteHostAddress);
                break;

            case HostConnectionType.Admin:
                ConnectionInstance = AdminProxy.Create(RemoteHostAddress);
                break;

            default:
                throw new NotSupportedException();
            }

            // 连接
            ConnectionInstance?.Connect();

            if (Connected)
            {
                //连接事件
                ServerEventArg arg = new ServerEventArg("Unknown", ServerEventType.Connected);

                LOG.Info($"启动{HostType.ToString()}对方端口{RemoteHostAddress}成功");

                OnConnectedHander?.BeginInvoke(arg, null, null);

                //启动心跳
                //StartHeartbeat();
            }
            else
            {
                //连接失败
                ServerEventArg arg = new ServerEventArg("Unknown", ServerEventType.Fault);

                LOG.Debug($"启动{HostType.ToString()}对方端口{RemoteHostAddress}失败");


                OnConnectFaultHander?.BeginInvoke(arg, null, null);

                ConnectionInstance = null;
            }
        }