public void SendAndReceiveChatMessages() { var testuser = new Jid("testuser", XMPP_HOST, "auction"); var chatClient1 = new XmppChatClient(testuser, "pass"); var messageReceivedEvent = new ManualResetEvent(false); var message = string.Empty; chatClient1.OnChatMessageReceived += (sender, msg) => chatClient1.SendMessageTo(msg.From, msg.Body); chatClient1.Login(); var auctionitem1 = new Jid("auction-item1", XMPP_HOST, "auction"); var chatClient2 = new XmppChatClient(auctionitem1, "auction"); chatClient2.OnChatMessageReceived += (s, m) => { message = m.Body; messageReceivedEvent.Set(); }; chatClient2.Login(); chatClient2.SendMessageTo(testuser, "hello"); TimeSpan timeout = 4.Seconds(); Assert.That(messageReceivedEvent.WaitOne(timeout), "Did not receive message within {0}", timeout); Assert.That(message, Is.EqualTo("hello")); }
public void AnnounceClosed() { auctionChat.SendMessageTo(singleMessageListener.SniperJid, @"SOLVersion: 1.1; Event: CLOSE;"); auctionChat.Close(); }