public void AttachInputChannel() { anInputChannel = UnderlyingMessaging.CreateDuplexInputChannel(Self); switch (MessagesFactoryType) { case YZXMessagesFactoryType.Duplex: DReceiver.AttachDuplexInputChannel(anInputChannel); break; } }
public YZXMessagingClient(string partner, YZXMessagesFactoryType messagetype = YZXMessagesFactoryType.Duplex) { Partner = partner; DSender = DSenderFactory.CreateDuplexTypedMessageSender <ResponseType, RequestType>(); anOutputChannel = UnderlyingMessaging.CreateDuplexOutputChannel(Partner); ConfigSender(); AttachOutputChannel(); }
public void B03_Pinging_NoResponseForPing() { // Create duplex input channel which will not send ping messages. IDuplexInputChannel aDuplexInputChannel = UnderlyingMessaging.CreateDuplexInputChannel(ChannelId); IDuplexOutputChannel aDuplexOutputChannel = MessagingSystemFactory.CreateDuplexOutputChannel(ChannelId); AutoResetEvent aDisconnectedEvent = new AutoResetEvent(false); bool aDisconnectedFlag = false; aDuplexOutputChannel.ConnectionClosed += (x, y) => { aDisconnectedFlag = true; aDisconnectedEvent.Set(); }; try { // Start listening. aDuplexInputChannel.StartListening(); // Allow some time for pinging. aDuplexOutputChannel.OpenConnection(); Assert.IsTrue(aDuplexOutputChannel.IsConnected); Thread.Sleep(2000); aDisconnectedEvent.WaitOne(); Assert.IsTrue(aDisconnectedFlag); Assert.IsFalse(aDuplexOutputChannel.IsConnected); } finally { aDuplexOutputChannel.CloseConnection(); aDuplexInputChannel.StopListening(); } }
public void AttachOutputChannel() { try { switch (MessagesFactoryType) { case YZXMessagesFactoryType.Duplex: if (DSender == null) { ConfigSender(); } else { if (DSender.IsDuplexOutputChannelAttached) { } else { try { anOutputChannel = UnderlyingMessaging.CreateDuplexOutputChannel(Partner); DSender.AttachDuplexOutputChannel(anOutputChannel); } catch (Exception ex) { Console.WriteLine(ex); } } } break; } } catch (Exception EX) { Console.WriteLine(EX); } }