1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

SMACK-412 Split the ping implementation to a server ping to replace keepalive and a simplified ping manager for manual pings of other entities.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13569 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2013-03-19 02:37:36 +00:00
parent a55b54f20b
commit aab1dcdabe
19 changed files with 749 additions and 651 deletions

View file

@ -57,11 +57,15 @@ public class DummyConnection extends Connection {
private final BlockingQueue<Packet> queue = new LinkedBlockingQueue<Packet>();
public DummyConnection() {
super(new ConnectionConfiguration("example.com"));
this(new ConnectionConfiguration("example.com"));
}
public DummyConnection(ConnectionConfiguration configuration) {
super(configuration);
for (ConnectionCreationListener listener : getConnectionCreationListeners()) {
listener.connectionCreated(this);
}
}
@Override
@ -191,15 +195,27 @@ public class DummyConnection extends Connection {
}
/**
* Returns the first packet that's sent through {@link #sendPacket(Packet)} and
* that has not been returned by earlier calls to this method. This method
* will block for up to two seconds if no packets have been sent yet.
* Returns the first packet that's sent through {@link #sendPacket(Packet)}
* and that has not been returned by earlier calls to this method.
*
* @return a sent packet.
* @throws InterruptedException
*/
public Packet getSentPacket() throws InterruptedException {
return queue.poll(2, TimeUnit.SECONDS);
return queue.poll();
}
/**
* Returns the first packet that's sent through {@link #sendPacket(Packet)}
* and that has not been returned by earlier calls to this method. This
* method will block for up to the specified number of seconds if no packets
* have been sent yet.
*
* @return a sent packet.
* @throws InterruptedException
*/
public Packet getSentPacket(int wait) throws InterruptedException {
return queue.poll(wait, TimeUnit.SECONDS);
}
/**