private void CreateServiceDispatcherHost() { this.communicatorServer?.Dispose(); this.communicatorServer = new PipeCommunicatorServer(PipeName); this.communicatorServer.Start(); this.testService = new TestService(); this.router = new Router(new Multiplexer(this.communicatorServer)); }
static void Main(string[] args) { var server = new PipeCommunicatorServer("testEchoService"); var router = new Router(new Multiplexer(server)); var echoService = new EchoService(); router.AddAllRoutes(new ReflectionService(echoService)); server.Start(); while (!echoService.GotExitRequest) { System.Threading.Thread.Sleep(100); } }
public void PipeAuthorization_CheckPath_InvalidPathTest() { this.communicatorServer = new PipeCommunicatorServer("CA25C0E2-72DE-46DC-845B-01A92E633D2B"); this.communicatorServer.Start(); PipeAuthorizationChecker checker = new PipeAuthorizationChecker(); this.communicatorServer.AuthorizationChecker = checker; checker.PathList.Clear(); this.channelFactory = new PipeChannelFactory(); IMessenger messenger = this.channelFactory.GetMessenger("pipe://CA25C0E2-72DE-46DC-845B-01A92E633D2B"); messenger.Send("test"); }
public void PipeAuthorization_CheckPathTest() { this.communicatorServer = new PipeCommunicatorServer("CA25C0E2-72DE-46DC-845B-01A92E633D2B"); this.communicatorServer.Start(); PipeAuthorizationChecker checker = new PipeAuthorizationChecker { EnableAuthenticodeCheck = false }; this.communicatorServer.AuthorizationChecker = checker; this.channelFactory = new PipeChannelFactory(); IMessenger messenger = this.channelFactory.GetMessenger("pipe://CA25C0E2-72DE-46DC-845B-01A92E633D2B"); messenger.Send("test"); }
public void TestInitialize() { string pipeName = "2EB256B1-F04F-49FB-97F6-099358AC3195"; this.server = new PipeCommunicatorServer(pipeName); this.server.PipeConnected += (sender, @event) => { this.serverMessenger = @event.Messenger; this.serverMessenger.MessageReceived += (o, e) => this.serverReceivedMessages.Add(e.Message); }; this.server.Start(); this.clientMessenger = PipeCommunicatorClient.Connect(pipeName); this.clientMessenger.MessageReceived += (sender, @event) => this.clientReceivedMessages.Add(@event.Message); WaitHelpers.WaitUntil(() => this.serverMessenger != null); }
public void PipeAuthorization_CheckSignatureTest() { this.communicatorServer = new PipeCommunicatorServer("CA25C0E2-72DE-46DC-845B-01A92E633D2B"); this.communicatorServer.Start(); PipeAuthorizationChecker checker = new PipeAuthorizationChecker(); this.communicatorServer.AuthorizationChecker = checker; string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PipeConnectorTest.exe"); var statrupInfo = new ProcessStartInfo { FileName = path, Arguments = "CA25C0E2-72DE-46DC-845B-01A92E633D2B", CreateNoWindow = true, UseShellExecute = false, }; using (var process = Process.Start(statrupInfo)) { WaitHelpers.WaitUntil(() => process.HasExited); Assert.AreEqual(0, process.ExitCode); } }