mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 09:39:39 +02:00
Rework SmackFuture and add async API based on it
This commit is contained in:
parent
0602ae064a
commit
f4391c07d7
8 changed files with 349 additions and 66 deletions
|
@ -22,9 +22,8 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.SmackFuture.InternalSmackFuture;
|
||||
import org.jivesoftware.smack.SmackFuture.SimpleInternalSmackFuture;
|
||||
import org.jivesoftware.smack.SmackFuture.InternalProcessStanzaSmackFuture;
|
||||
import org.jivesoftware.smack.SmackFuture.SimpleInternalProcessStanzaSmackFuture;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -32,10 +31,10 @@ import org.junit.Test;
|
|||
public class SmackFutureTest {
|
||||
|
||||
@Test
|
||||
public void simpleSmackFutureSuccessTest() throws NotConnectedException, InterruptedException, ExecutionException {
|
||||
InternalSmackFuture<Boolean> future = new SimpleInternalSmackFuture<Boolean>() {
|
||||
public void simpleSmackFutureSuccessTest() throws InterruptedException, ExecutionException {
|
||||
InternalProcessStanzaSmackFuture<Boolean, Exception> future = new SimpleInternalProcessStanzaSmackFuture<Boolean, Exception>() {
|
||||
@Override
|
||||
protected void handleStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
|
||||
protected void handleStanza(Stanza stanza) {
|
||||
setResult(true);
|
||||
}
|
||||
};
|
||||
|
@ -47,9 +46,9 @@ public class SmackFutureTest {
|
|||
|
||||
@Test(expected = TimeoutException.class)
|
||||
public void simpleSmackFutureTimeoutTest() throws InterruptedException, ExecutionException, TimeoutException {
|
||||
InternalSmackFuture<Boolean> future = new SimpleInternalSmackFuture<Boolean>() {
|
||||
InternalProcessStanzaSmackFuture<Boolean, Exception> future = new SimpleInternalProcessStanzaSmackFuture<Boolean, Exception>() {
|
||||
@Override
|
||||
protected void handleStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
|
||||
protected void handleStanza(Stanza stanza) {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue