public IChannelListener <TPackage> Create(ListenOptions listenOptions, ServerOptions <TPackage> serverOptions) { SimpleChannelFactory <TPackage> channelFactory = socket => { return(new ValueTask <Channel <TPackage> >(new TcpPipeChannel <TPackage>(socket, serverOptions, _pipePackageFilter))); }; return(new TcpChannelListener <TPackage>(listenOptions, channelFactory)); }
public void InitializeEndpointTest2() { SimpleChannelFactory factory = new SimpleChannelFactory(); Assert.AreEqual(null, factory.Endpoint, "#01"); factory.InitEndpoint("CtorUseCase2_1", null); Assert.AreEqual(typeof(BasicHttpBinding), factory.Endpoint.Binding.GetType(), "#02"); Assert.AreEqual(new EndpointAddress("http://test2_1"), factory.Endpoint.Address, "#03"); Assert.AreEqual(typeof(ICtorUseCase2), factory.Endpoint.Contract.ContractType, "#04"); }
public void ApplyConfigurationTest1() { SimpleChannelFactory factory = new SimpleChannelFactory(); Binding b = new WSHttpBinding(); factory.InitEndpoint(b, null); factory.ApplyConfig("CtorUseCase2_1"); Assert.AreEqual(new EndpointAddress("http://test2_1"), factory.Endpoint.Address, "#03"); Assert.AreEqual(b, factory.Endpoint.Binding, "#02"); }
public void InitializeEndpointTest1() { SimpleChannelFactory factory = new SimpleChannelFactory(); Assert.AreEqual(null, factory.Endpoint, "#01"); Binding b = new WSHttpBinding(); factory.InitEndpoint(b, null); Assert.AreEqual(b, factory.Endpoint.Binding, "#02"); Assert.AreEqual(null, factory.Endpoint.Address, "#03"); Assert.AreEqual(typeof(ICtorUseCase2), factory.Endpoint.Contract.ContractType, "#04"); }
public void InitializeEndpointTest3() { SimpleChannelFactory factory = new SimpleChannelFactory(); Assert.AreEqual(null, factory.Endpoint, "#01"); factory.InitEndpoint("CtorUseCase2_1", null); Binding b = new WSHttpBinding(); factory.InitEndpoint(b, null); Assert.AreEqual(b, factory.Endpoint.Binding, "#02"); Assert.AreEqual(null, factory.Endpoint.Address, "#03"); }
public void ApplyConfigurationTest2() { SimpleChannelFactory factory = new SimpleChannelFactory(); Binding b = new WSHttpBinding(); factory.InitEndpoint(b, new EndpointAddress("http://test")); factory.ApplyConfig("CtorUseCase2_2"); Assert.AreEqual(new EndpointAddress("http://test"), factory.Endpoint.Address, "#03"); Assert.IsNotNull(factory.Endpoint.Behaviors.Find <CallbackDebugBehavior> (), "#04"); Assert.AreEqual(true, factory.Endpoint.Behaviors.Find <CallbackDebugBehavior> ().IncludeExceptionDetailInFaults, "#04"); factory.ApplyConfig("CtorUseCase2_3"); Assert.IsNotNull(factory.Endpoint.Behaviors.Find <CallbackDebugBehavior> (), "#04"); Assert.AreEqual(false, factory.Endpoint.Behaviors.Find <CallbackDebugBehavior> ().IncludeExceptionDetailInFaults, "#04"); }
public TcpChannelListener(ListenOptions options, SimpleChannelFactory <TPackage> channelFactory) { _options = options; _channelFactory = channelFactory ?? throw new ArgumentNullException(nameof(channelFactory)); }