示例#1
0
        public MockConnectionPair(PresentationBuilder <TOriginContractInterface> originBuilder,
                                  PresentationBuilder <TProxyContractInterface> proxyBuider, bool connect = true)
        {
            ClientChannel = new TestChannel();

            Server          = new TestChannelServer <TOriginContractInterface>(originBuilder);
            ProxyConnection = proxyBuider.UseChannel(ClientChannel).Build();
            if (connect)
            {
                Connect();
            }
        }
示例#2
0
        public static IConnection <TContract, TcpChannel> CreateTcpClientConnection <TContract>(
            this PresentationBuilder <TContract> builder, IPEndPoint endPoint)
            where TContract : class

        {
            return(builder.UseChannel(() =>
            {
                var channel = new TcpChannel();
                channel.Connect(endPoint);
                return channel;
            }).Build());
        }
示例#3
0
 public TcpConnectionPair(PresentationBuilder <TOriginContractInterface> originBuilder,
                          PresentationBuilder <TProxyContractInterface> proxyBuider, bool connect = true)
 {
     Server               = originBuilder.CreateTcpServer(IPAddress.Loopback, 12345);
     ClientChannel        = new TcpChannel();
     ProxyConnection      = proxyBuider.UseChannel(ClientChannel).Build();
     _eventAwaiter        = new EventAwaiter <IConnection <TOriginContractInterface, TcpChannel> >();
     Server.AfterConnect += _eventAwaiter.EventRaised;
     if (connect)
     {
         Connect();
     }
 }