public void CreateDisposeAndRecreateComponentHostForTcpSimplexChannel() { var protocol = new TcpCustomServerProtocolSetup(8087, new NullAuthenticationProvider(), true); using (var host = new ZyanComponentHost("RecreateClientConnectionTestHost_TcpSimplex", protocol)) { host.RegisterComponent<ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall); } using (var host = new ZyanComponentHost("RecreateClientConnectionTestHost_TcpSimplex", protocol)) { host.RegisterComponent<ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall); } }
private TcpSimplexServerHostEnvironment() { var protocol = new TcpCustomServerProtocolSetup(8085, new NullAuthenticationProvider(), true); _host = new ZyanComponentHost("RecreateClientConnectionTestHost_TcpSimplex", protocol); _host.RegisterComponent<ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall); }
private EventServer() { _catalog = new ComponentCatalog(); _catalog.RegisterComponent<IEventComponentSingleton, EventComponentSingleton>(ActivationType.Singleton); _catalog.RegisterComponent<IEventComponentSingleCall, EventComponentSingleCall>(ActivationType.SingleCall); _catalog.RegisterComponent<ICallbackComponentSingleton, CallbackComponentSingleton>(ActivationType.Singleton); _catalog.RegisterComponent<ICallbackComponentSingleCall, CallbackComponentSingleCall>(ActivationType.SingleCall); _catalog.RegisterComponent<IRequestResponseCallbackSingleCall, RequestResponseCallbackSingleCall>(ActivationType.SingleCall); _catalog.RegisterComponent<ITimerTriggeredEvent, TimerTriggeredEvent>(ActivationType.Singleton); // Setting compression threshold to 1 byte means that all messages will be compressed. // This setting should not be used in production code because smaller packets will grow in size. // By default, Zyan only compresses messages larger than 64 kilobytes. var tcpBinaryProtocol = new TcpBinaryServerProtocolSetup(8082); tcpBinaryProtocol.AddServerSinkBeforeFormatter(new CompressionServerChannelSinkProvider(1, CompressionMethod.LZF)); _tcpBinaryHost = new ZyanComponentHost("TcpBinaryEventTest", tcpBinaryProtocol, _catalog); var ipcBinaryProtocol = new IpcBinaryServerProtocolSetup("IpcTestServer"); ipcBinaryProtocol.AddServerSinkBeforeFormatter(new CompressionServerChannelSinkProvider(1, CompressionMethod.DeflateStream)); _ipcBinaryHost = new ZyanComponentHost("IpcBinaryEventTest", ipcBinaryProtocol, _catalog); var tcpCustomProtocol = new TcpCustomServerProtocolSetup(8083, new NullAuthenticationProvider(), true) { CompressionThreshold = 1, CompressionMethod = CompressionMethod.DeflateStream }; _tcpCustomHost = new ZyanComponentHost("TcpCustomEventTest", tcpCustomProtocol, _catalog); var tcpDuplexProtocol = new TcpDuplexServerProtocolSetup(8084, new NullAuthenticationProvider(), true) { CompressionThreshold = 1, CompressionMethod = CompressionMethod.DeflateStream }; tcpDuplexProtocol.AddChannelSetting("bindTo", "127.0.0.1"); _tcpDuplexHost = new ZyanComponentHost("TcpDuplexEventTest", tcpDuplexProtocol, _catalog); var httpCustomProtocol = new HttpCustomServerProtocolSetup(8085, new NullAuthenticationProvider(), true) { CompressionThreshold = 1, CompressionMethod = CompressionMethod.LZF }; _httpCustomHost = new ZyanComponentHost("HttpCustomEventTest", httpCustomProtocol, _catalog); var nullChannelProtocol = new NullServerProtocolSetup(1234); _nullChannelHost = new ZyanComponentHost("NullEventTest", nullChannelProtocol, _catalog); // use legacy blocking events mode because we check the handlers synchronously ZyanComponentHost.LegacyBlockingEvents = true; }