Example #1
0
        public static IntercomDuplexChannel <TCallback, TService> CreateSlaveChannel(TCallback callbackService, string pipeName)
        {
            using (var client = new IntercomClientChannel <IDispatcherService>(pipeName + Constants.Dispatcher))
            {
                client.Connect();

                var name = client.Execute(Constants.DispatchMethod).ToString();

                return(new IntercomDuplexChannel <TCallback, TService>(callbackService, name, false));
            }
        }
Example #2
0
        public void TestChannelDispose()
        {
            string pipeName = "Vkm.TestPipe2";

            var service = new Test1();
            IntercomServerChannel <Test1> serverChannel = new IntercomServerChannel <Test1>(service, pipeName);
            IntercomClientChannel <Test1> clientChannel = new IntercomClientChannel <Test1>(pipeName);

            clientChannel.Connect();

            object disposed = null;

            serverChannel.ConnectionClosed += (sender, args) => disposed = new object();

            Assert.AreEqual(null, disposed);
            clientChannel.Dispose();
            Thread.Sleep(500);
            Assert.AreNotEqual(null, disposed);
        }