mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 10:49:41 +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:
parent
a55b54f20b
commit
aab1dcdabe
19 changed files with 749 additions and 651 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue