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

Improve JFT API

This commit is contained in:
vanitasvitae 2017-08-15 17:43:06 +02:00
parent d7df408661
commit e53165a96c
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
8 changed files with 112 additions and 40 deletions

View file

@ -25,7 +25,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import java.io.FileInputStream;
import java.util.concurrent.Future;
import java.io.IOException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
@ -123,14 +123,14 @@ public class JetIntegrationTest extends AbstractOmemoIntegrationTest {
received.signal();
}
});
Future<Void> f = offer.accept(conTwo, target);
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
offer.accept(conTwo, target);
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException | IOException e) {
received.signal(e);
}
}
});
ja.sendEncryptedFile(conTwo.getUser().asFullJidOrThrow(), source, oa);
ja.sendEncryptedFile(source, conTwo.getUser().asFullJidOrThrow(), oa);
received.waitForResult(60 * 1000);

View file

@ -107,8 +107,8 @@ public class JingleFileTransferIntegrationTest extends AbstractSmackIntegrationT
});
try {
receiveFuture.add(offer.accept(conTwo, target));
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
offer.accept(conTwo, target);
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException | IOException e) {
fail(e.toString());
}
}

View file

@ -23,8 +23,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.Future;
import java.util.logging.Level;
import org.jivesoftware.smack.SmackException;
@ -95,8 +93,6 @@ public class JingleFileTransferTransportFallbackIntegrationTest extends Abstract
JingleFileTransferManager aftm = JingleFileTransferManager.getInstanceFor(conOne);
JingleFileTransferManager bftm = JingleFileTransferManager.getInstanceFor(conTwo);
final ArrayList<Future<Void>> receiveFuture = new ArrayList<>(); //Uglaay
bftm.addIncomingFileOfferListener(new IncomingFileOfferListener() {
@Override
public void onIncomingFileOffer(IncomingFileOfferController offer) {
@ -120,8 +116,8 @@ public class JingleFileTransferTransportFallbackIntegrationTest extends Abstract
});
try {
receiveFuture.add(offer.accept(conTwo, target));
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
offer.accept(conTwo, target);
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException | IOException e) {
fail(e.toString());
}
}