1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-06 13:11:08 +01:00

SMACK-412 Added the pingMyServer back in, cleaned up unneeded synchronization and removed minimum ping interval.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13588 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2013-03-23 11:59:08 +00:00
parent 999c86ef4c
commit a14178990b
8 changed files with 174 additions and 42 deletions

View file

@ -21,9 +21,12 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.ping.packet.Ping;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ServerPingTest {
public class KeepaliveTest {
private static final long PING_MINIMUM = 1000;
private static String TO = "juliet@capulet.lit/balcony";
private static String ID = "s2c1";
@ -31,7 +34,21 @@ public class ServerPingTest {
{
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
}
private int originalTimeout;
@Before
public void resetProperties()
{
originalTimeout = SmackConfiguration.getPacketReplyTimeout();
SmackConfiguration.setPacketReplyTimeout(1000);
}
@After
public void restoreProperties()
{
SmackConfiguration.setPacketReplyTimeout(originalTimeout);
}
/*
* Stanza copied from spec
*/
@ -133,7 +150,7 @@ public class ServerPingTest {
private DummyConnection getConnection() {
DummyConnection con = new DummyConnection();
ServerPingManager mgr = ServerPingManager.getInstanceFor(con);
mgr.setPingInterval(ServerPingManager.PING_MINIMUM);
mgr.setPingInterval(PING_MINIMUM);
return con;
}
@ -141,7 +158,7 @@ public class ServerPingTest {
private ThreadedDummyConnection getThreadedConnection() {
ThreadedDummyConnection con = new ThreadedDummyConnection();
ServerPingManager mgr = ServerPingManager.getInstanceFor(con);
mgr.setPingInterval(ServerPingManager.PING_MINIMUM);
mgr.setPingInterval(PING_MINIMUM);
return con;
}
@ -157,6 +174,6 @@ public class ServerPingTest {
}
private long getWaitTime() {
return ServerPingManager.PING_MINIMUM + SmackConfiguration.getPacketReplyTimeout() + 3000;
return PING_MINIMUM + SmackConfiguration.getPacketReplyTimeout() + 3000;
}
}