diff options
author | Alex Clayton <alex.clayton@isode.com> | 2016-03-16 15:45:11 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2016-03-16 15:57:40 (GMT) |
commit | f693c8e0fa9c6a051cdf6260f131db3d9355b49f (patch) | |
tree | 10ca50f0c3494566e005f9c202f7d3b6c6d036f9 /test/com/isode | |
parent | 8b9891afc85d114ff1e9c9a0291a4aaee8baeb09 (diff) | |
download | stroke-f693c8e0fa9c6a051cdf6260f131db3d9355b49f.zip stroke-f693c8e0fa9c6a051cdf6260f131db3d9355b49f.tar.bz2 |
Support early IBB use in Jingle File Transfer
As per swiften patch of the same name
(75703db2de5bbfb6622286600362016edb42dfb0).
Previously Jingle File Transfer in Stroke only used IBB transport as
fallback mechanism. With this patch Stroke will use IBB transport
candidates directly in the first session-initate/session-accept
message if the other party only supports IBB.
Test-information: Unit tests all pass.
Change-Id: Ice73a6028f10c63490bdb775a0a407fad48f587a
Diffstat (limited to 'test/com/isode')
-rw-r--r-- | test/com/isode/stroke/filetransfer/OutgoingJingleFileTransferTest.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/com/isode/stroke/filetransfer/OutgoingJingleFileTransferTest.java b/test/com/isode/stroke/filetransfer/OutgoingJingleFileTransferTest.java index 4532efb..f8b76b8 100644 --- a/test/com/isode/stroke/filetransfer/OutgoingJingleFileTransferTest.java +++ b/test/com/isode/stroke/filetransfer/OutgoingJingleFileTransferTest.java @@ -98,20 +98,25 @@ public class OutgoingJingleFileTransferTest { assertNotNull(description); assertEquals(1048576,description.getFileInfo().getSize()); - JingleS5BTransportPayload transport = null; - if (call.payload instanceof JingleS5BTransportPayload) { - transport = (JingleS5BTransportPayload) call.payload; + JingleIBBTransportPayload transport = null; + if (call.payload instanceof JingleIBBTransportPayload) { + transport = (JingleIBBTransportPayload) call.payload; + } + else { + System.out.println(call.payload.getClass().getName()); } assertNotNull(transport); } @Test public void test_FallbackToIBBAfterFailingS5b() { - OutgoingJingleFileTransfer transfer = createTestling(); + OutgoingJingleFileTransfer transfer = + createTestling(new FileTransferOptions().withAssistedAllowed(true).withDirectAllowed(true).withProxiedAllowed(true)); transfer.start(); FakeJingleSession.InitiateCall call = getCall(FakeJingleSession.InitiateCall.class,0); + assertTrue(call.payload instanceof JingleS5BTransportPayload); fakeJingleSession.handleSessionAcceptReceived(call.id, call.description, call.payload); // Send candidate failure @@ -211,13 +216,16 @@ public class OutgoingJingleFileTransferTest { } private OutgoingJingleFileTransfer createTestling() { + return createTestling(new FileTransferOptions().withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false)); + } + + private OutgoingJingleFileTransfer createTestling(FileTransferOptions options) { JID to = new JID("test@foo.com/bla"); JingleFileTransferFileInfo fileInfo = new JingleFileTransferFileInfo(); fileInfo.setDescription("some file"); fileInfo.setName("test.bin"); fileInfo.addHash(new HashElement("sha-1", new ByteArray())); fileInfo.setSize(1024 * 1024); - FileTransferOptions options = (new FileTransferOptions()).withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false); return new OutgoingJingleFileTransfer(to, fakeJingleSession, stream, ftTransporterFactory, timeFactory, idGen, fileInfo, options, crypto); } |