private TcpSimplexServerHostEnvironment() { var protocol = new TcpCustomServerProtocolSetup(8085, new NullAuthenticationProvider(), true); _host = new ZyanComponentHost("RecreateClientConnectionTestHost_TcpSimplex", protocol); _host.RegisterComponent <ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall); }
public void TcpCustomServerChannelDoesntReturn0000AsDiscoverableUrl() { var proto = new TcpCustomServerProtocolSetup(12346, null); var url = proto.GetDiscoverableUrl("SomeServer"); Assert.IsFalse(string.IsNullOrEmpty(url)); Assert.AreNotEqual("tcp://0.0.0.0:12346/SomeServer", url); }
public void TestTcpCustomVulnerability(bool encryption, object payload) { var portNumber = 23456; var serverUrl = $"tcp://localhost:{portNumber}/{HostName}"; var serverSetup = new TcpCustomServerProtocolSetup(portNumber, null, encryption); var clientSetup = new TcpCustomClientProtocolSetup(encryption); TestVulnerability(HostName, serverUrl, serverSetup, clientSetup, payload); }
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 ZyanSettings.LegacyBlockingEvents = true; ZyanSettings.LegacyBlockingSubscriptions = true; }
private TcpSimplexServerHostEnvironment() { // use custom SRP parameters var accounts = new SampleAccountRepository(CustomSrpParameters); var provider = new SrpAuthenticationProvider(accounts, CustomSrpParameters); var protocol = new TcpCustomServerProtocolSetup(8091, provider, true); _host = new ZyanComponentHost("CustomAuthenticationTestHost_TcpSimplex", protocol); _host.RegisterComponent <ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall); }
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); } }