Search in sources :

Example 16 with DummyConnection

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

the class PingTest method checkSendingPing.

@Test
public void checkSendingPing() throws InterruptedException, SmackException, IOException, XMPPException {
    DummyConnection dummyCon = getAuthentiactedDummyConnection();
    PingManager pinger = PingManager.getInstanceFor(dummyCon);
    try {
        pinger.ping(DUMMY_AT_EXAMPLE_ORG);
    } catch (SmackException e) {
    // Ignore the fact the server won't answer for this unit test.
    }
    Stanza sentPacket = dummyCon.getSentPacket();
    assertTrue(sentPacket instanceof Ping);
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) ThreadedDummyConnection(org.jivesoftware.smack.ThreadedDummyConnection) SmackException(org.jivesoftware.smack.SmackException) Stanza(org.jivesoftware.smack.packet.Stanza) Ping(org.jivesoftware.smackx.ping.packet.Ping) Test(org.junit.Test)

Example 17 with DummyConnection

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

the class ChatConnectionTest method validateDefaultSetNormalIncludedFalse.

@Test
public void validateDefaultSetNormalIncludedFalse() {
    ChatManager.setDefaultIsNormalIncluded(false);
    assertFalse(ChatManager.getInstanceFor(new DummyConnection()).isNormalIncluded());
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Test(org.junit.Test)

Example 18 with DummyConnection

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

the class RosterOfflineTest method setup.

@Before
public void setup() {
    this.connection = new DummyConnection();
    assertFalse(connection.isConnected());
    roster = Roster.getInstanceFor(connection);
    assertNotNull(roster);
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Before(org.junit.Before)

Example 19 with DummyConnection

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

the class PingTest method checkPingToServerTimeout.

@Test
public void checkPingToServerTimeout() throws SmackException, IOException, XMPPException, InterruptedException {
    DummyConnection con = getAuthenticatedDummyConnectionWithoutIqReplies();
    PingManager pinger = PingManager.getInstanceFor(con);
    boolean res = pinger.pingMyServer();
    assertFalse(res);
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) ThreadedDummyConnection(org.jivesoftware.smack.ThreadedDummyConnection) Test(org.junit.Test)

Example 20 with DummyConnection

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

the class FileTransferNegotiatorTest method setUp.

@Before
public void setUp() throws Exception {
    connection = new DummyConnection();
    connection.connect();
    connection.login();
    ServiceDiscoveryManager.getInstanceFor(connection);
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Before(org.junit.Before)

Aggregations

DummyConnection (org.jivesoftware.smack.DummyConnection)20 Test (org.junit.Test)13 Before (org.junit.Before)6 ThreadedDummyConnection (org.jivesoftware.smack.ThreadedDummyConnection)5 Stanza (org.jivesoftware.smack.packet.Stanza)5 IQ (org.jivesoftware.smack.packet.IQ)3 Message (org.jivesoftware.smack.packet.Message)2 TestRosterListener (org.jivesoftware.smack.roster.RosterTest.TestRosterListener)2 Ping (org.jivesoftware.smackx.ping.packet.Ping)2 XMLBuilder (com.jamesmurty.utils.XMLBuilder)1 SmackException (org.jivesoftware.smack.SmackException)1 NoResponseException (org.jivesoftware.smack.SmackException.NoResponseException)1 DirectoryRosterStore (org.jivesoftware.smack.roster.rosterstore.DirectoryRosterStore)1 AuthMechanism (org.jivesoftware.smack.sasl.packet.SaslStreamElements.AuthMechanism)1 Response (org.jivesoftware.smack.sasl.packet.SaslStreamElements.Response)1 LastActivity (org.jivesoftware.smackx.iqlast.packet.LastActivity)1 Version (org.jivesoftware.smackx.iqversion.packet.Version)1