1 52 53 package org.jivesoftware.smack; 54 55 import org.jivesoftware.smack.filter.*; 56 import org.jivesoftware.smack.packet.*; 57 import org.jivesoftware.smack.test.SmackTestCase; 58 59 60 public class PacketReaderTest extends SmackTestCase { 61 62 66 public PacketReaderTest(String arg0) { 67 super(arg0); 68 } 69 70 74 public void testIQNotImplemented() { 75 76 IQ iqPacket = new IQ() { 79 public String getChildElementXML() { 80 return "<query xmlns=\"my:ns:test\"/>"; 81 } 82 }; 83 iqPacket.setTo(getFullJID(1)); 84 iqPacket.setType(IQ.Type.GET); 85 86 PacketCollector collector = getConnection(0).createPacketCollector( 88 new PacketIDFilter(iqPacket.getPacketID())); 89 getConnection(0).sendPacket(iqPacket); 90 IQ response = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); 91 if (response == null) { 92 fail("No response from the other user."); 93 } 94 assertEquals("The received IQ is not of type ERROR", IQ.Type.ERROR, response.getType()); 95 assertEquals("The error code is not 501", 501, response.getError().getCode()); 96 collector.cancel(); 97 } 98 99 protected int getMaxConnections() { 100 return 2; 101 } 102 } 103 | Popular Tags |