Search in sources :

Example 11 with ThreadedDummyConnection

use of org.jivesoftware.smack.ThreadedDummyConnection in project Smack by igniterealtime.

the class PingTest method checkUnuccessfulDiscoRequest.

@Test
public void checkUnuccessfulDiscoRequest() throws Exception {
    ThreadedDummyConnection con = getAuthentiactedDummyConnection();
    DiscoverInfo info = new DiscoverInfo();
    info.addFeature(Ping.NAMESPACE);
    //@formatter:off
    String reply = "<iq type='result' id='qrzSp-16' to='test@myserver.com'>" + "<query xmlns='http://jabber.org/protocol/disco#info'><identity category='client' type='pc' name='Pidgin'/>" + "<feature var='urn:xmpp:noping'/>" + "</query></iq>";
    //@formatter:on
    IQ discoReply = (IQ) PacketParserUtils.parseStanza(reply);
    con.addIQReply(discoReply);
    PingManager pinger = PingManager.getInstanceFor(con);
    boolean pingSupported = pinger.isPingSupported(DUMMY_AT_EXAMPLE_ORG);
    assertFalse(pingSupported);
}
Also used : ThreadedDummyConnection(org.jivesoftware.smack.ThreadedDummyConnection) DiscoverInfo(org.jivesoftware.smackx.disco.packet.DiscoverInfo) IQ(org.jivesoftware.smack.packet.IQ) Test(org.junit.Test)

Aggregations

ThreadedDummyConnection (org.jivesoftware.smack.ThreadedDummyConnection)11 Test (org.junit.Test)9 IQ (org.jivesoftware.smack.packet.IQ)4 DiscoverInfo (org.jivesoftware.smackx.disco.packet.DiscoverInfo)4 Identity (org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity)2 PubSub (org.jivesoftware.smackx.pubsub.packet.PubSub)2 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)1 XMPPError (org.jivesoftware.smack.packet.XMPPError)1 Before (org.junit.Before)1