mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-13 06:21:08 +01:00
Cleanup of pingMyServer() API
only throw NotConnectedException, otherwise return false. Before as some sort of exception was always thrown in the error case.
This commit is contained in:
parent
17a254edca
commit
665d65836c
2 changed files with 21 additions and 17 deletions
|
|
@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
|
|||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.ThreadedDummyConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
|
@ -180,18 +181,12 @@ public class PingTest extends InitExtensions {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void checkPingToServerTimeout() throws SmackException {
|
||||
public void checkPingToServerTimeout() throws NotConnectedException {
|
||||
DummyConnection con = new DummyConnection();
|
||||
PingManager pinger = PingManager.getInstanceFor(con);
|
||||
|
||||
try {
|
||||
pinger.pingMyServer();
|
||||
}
|
||||
catch (NoResponseException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
fail();
|
||||
boolean res = pinger.pingMyServer();
|
||||
assertFalse(res);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue