public static void StartServer(TestContext ctx) { var serverSetup = new NullServerProtocolSetup(1234); ZyanHost = new ZyanComponentHost("DuckTypingServer", serverSetup); // registration-time check ZyanHost.RegisterComponent<IDuck, Platypus>("Platypus"); // invocation-time check (object factory can't be verified during registration) ZyanHost.RegisterComponent<IDuck>("Chicken", () => new Chicken()); ZyanConnection = new ZyanConnection("null://NullChannel:1234/DuckTypingServer"); }
public static void StartServer(TestContext ctx) { ZyanComponentHost.LegacyBlockingEvents = true; var serverSetup = new NullServerProtocolSetup(2345); ZyanHost = new ZyanComponentHost("EventsServer", serverSetup); ZyanHost.RegisterComponent<ISampleServer, SampleServer>("Singleton", ActivationType.Singleton); ZyanHost.RegisterComponent<ISampleServer, SampleServer>("SingleCall", ActivationType.SingleCall); ZyanConnection = new ZyanConnection("null://NullChannel:2345/EventsServer"); }
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; }