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(); } }
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()); }
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(); } }