diff --git a/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java b/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java index 3a0a95124..35aeaed9b 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java @@ -57,9 +57,10 @@ public class ThreadedDummyConnection extends DummyConnection { replyQ.add(replyPacket); } replyPacket.setStanzaId(packet.getStanzaId()); - replyPacket.setFrom(packet.getTo()); replyPacket.setTo(packet.getFrom()); - replyPacket.setType(Type.result); + if (replyPacket.getType() == null) { + replyPacket.setType(Type.result); + } new ProcessQueue(replyQ).start(); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java index 1197aaa7b..c4bf45674 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java @@ -26,7 +26,9 @@ import org.jivesoftware.smack.ThreadedDummyConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smack.packet.IQ.Type; import org.jivesoftware.smack.packet.XMPPError.Condition; +import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity; import org.jivesoftware.smackx.pubsub.packet.PubSub; @@ -39,7 +41,7 @@ import org.junit.Test; * @author Robin Collier * */ -public class ConfigureFormTest +public class ConfigureFormTest extends InitExtensions { @Test public void checkChildrenAssocPolicy() @@ -55,6 +57,8 @@ public class ConfigureFormTest ThreadedDummyConnection con = ThreadedDummyConnection.newInstance(); PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE); DiscoverInfo info = new DiscoverInfo(); + info.setType(Type.result); + info.setFrom(PubSubManagerTest.DUMMY_PUBSUB_SERVICE); Identity ident = new Identity("pubsub", null, "leaf"); info.addIdentity(ident); con.addIQReply(info); @@ -62,6 +66,8 @@ public class ConfigureFormTest Node node = mgr.getNode("princely_musings"); PubSub errorIq = new PubSub(); + errorIq.setType(Type.error); + errorIq.setFrom(PubSubManagerTest.DUMMY_PUBSUB_SERVICE); XMPPError.Builder error = XMPPError.getBuilder(Condition.forbidden); errorIq.setError(error); con.addIQReply(errorIq);