1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-15 03:59:38 +02:00

Use createPacketCollectorAndSend in FileTransferNegoiator

also fixes a potential PacketCollector leak.
This commit is contained in:
Florian Schmaus 2014-08-04 18:16:56 +02:00
parent 70f1c22bb2
commit d10ff92d44
3 changed files with 11 additions and 12 deletions

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.filetransfer;
import static org.junit.Assert.assertTrue;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.junit.After;
@ -48,7 +49,11 @@ public class FileTransferNegotiatorTest {
@Test
public void verifyForm() throws Exception {
FileTransferNegotiator fileNeg = FileTransferNegotiator.getInstanceFor(connection);
fileNeg.negotiateOutgoingTransfer("me", "streamid", "file", 1024, null, 10);
try {
fileNeg.negotiateOutgoingTransfer("me", "streamid", "file", 1024, null, 10);
} catch (NoResponseException e) {
// Ignore
}
Packet packet = connection.getSentPacket();
String xml = packet.toXML().toString();
assertTrue(xml.indexOf("var='stream-method' type='list-single'") != -1);