1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-05 12:41:08 +01:00

Fixed & improved test cases.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@8790 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2007-07-23 02:06:30 +00:00 committed by gato
parent 52958e64f7
commit 5d9d7a7b80
6 changed files with 113 additions and 77 deletions

View file

@ -20,10 +20,11 @@
package org.jivesoftware.smackx;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.test.SmackTestCase;
import org.jivesoftware.smackx.packet.Version;
/**
* Ensure that stream compression (JEP-138) is correctly supported by Smack.
@ -55,6 +56,24 @@ public class CompressionTest extends SmackTestCase {
assertTrue("Connection is not using stream compression", connection.isUsingCompression());
// Request the version of the server
Version version = new Version();
version.setType(IQ.Type.GET);
version.setTo(getServiceName());
// Create a packet collector to listen for a response.
PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(version.getPacketID()));
connection.sendPacket(version);
// Wait up to 5 seconds for a result.
IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Close the collector
collector.cancel();
assertNotNull("No reply was received from the server", result);
assertEquals("Incorrect IQ type from server", IQ.Type.RESULT, result.getType());
// Close connection
connection.disconnect();
}