Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.IQ

@author Matt Tucker

        CoinIQ coinIQ = (CoinIQ)packet;

        //first ack all "set" requests.
        if(coinIQ.getType() == IQ.Type.SET)
        {
            IQ ack = IQ.createResultIQ(coinIQ);
            parentProvider.getConnection().sendPacket(ack);
        }

        String sid = coinIQ.getSID();
View Full Code Here


            //the owners of this packet's sid

            //first ack all "set" requests.
            if(jingleIQ.getType() == IQ.Type.SET)
            {
                IQ ack = IQ.createResultIQ(jingleIQ);
                protocolProvider.getConnection().sendPacket(ack);
            }

            try
            {
                processJingleIQ(jingleIQ);
            }
            catch(Throwable t)
            {
                logger.info("Error while handling incoming Jingle packet: ", t);

                /*
                 * The Javadoc on ThreadDeath says: If ThreadDeath is caught by
                 * a method, it is important that it be rethrown so that the
                 * thread actually dies.
                 */
                if (t instanceof ThreadDeath)
                    throw (ThreadDeath) t;
            }
        }
        else if(packet instanceof SessionIQ)
        {
            SessionIQ sessionIQ = (SessionIQ)packet;

            //first ack all "set" requests.
            if(sessionIQ.getType() == IQ.Type.SET)
            {
                IQ ack = IQ.createResultIQ(sessionIQ);
                protocolProvider.getConnection().sendPacket(ack);
            }

            try
            {
View Full Code Here

        PingPacket pingRequest = new PingPacket();
        pingRequest.setType(IQ.Type.GET);
        pingRequest.setTo(SERVER_DOMAIN);
        pingRequest.setFrom(TEST_USERNAME1);

        IQ result = (IQ)sendSync(client, pingRequest);
       
        assertNotNull(result);
        assertEquals(IQ.Type.RESULT, result.getType());
        assertEquals(SERVER_DOMAIN, result.getFrom());
        assertEquals(TEST_USERNAME1, result.getTo());
    }
View Full Code Here

        PingPacket pingRequest = new PingPacket();
        pingRequest.setType(IQ.Type.GET);
        pingRequest.setTo(SERVER_DOMAIN);
        pingRequest.setFrom(TEST_USERNAME1);

        IQ result = (IQ)sendSync(client, pingRequest);
       
       
        assertNotNull(result);
        assertEquals(IQ.Type.ERROR, result.getType());
        assertEquals(SERVER_DOMAIN, result.getFrom());
        assertEquals(TEST_USERNAME1, result.getTo());
        assertEquals("service-unavailable", result.getError().getCondition());
    }
View Full Code Here

        PingPacket pingRequest = new PingPacket();
        pingRequest.setType(IQ.Type.GET);
        pingRequest.setTo(SERVER_DOMAIN);
        pingRequest.setFrom(TEST_USERNAME1);

        IQ result = (IQ) sendSync(client, pingRequest);

        assertNotNull(result);
        assertEquals(IQ.Type.RESULT, result.getType());
        assertEquals(SERVER_DOMAIN, result.getFrom());
        assertEquals(TEST_USERNAME1, result.getTo());
    }
View Full Code Here

public class BasicClient {

    static class IQListener implements PacketListener {

        public void processPacket(Packet packet) {
            IQ iq = (IQ) packet;
            String iqString = iq.toString();
            System.out.println("T" + System.currentTimeMillis() + " IQ: " + iqString + ": " + iq.toXML());
        }
View Full Code Here

        PingPacket pingRequest = new PingPacket();
        pingRequest.setType(IQ.Type.GET);
        pingRequest.setTo(SERVER_DOMAIN);
        pingRequest.setFrom(TEST_USERNAME1);

        IQ result = (IQ) sendSync(client, pingRequest);

        assertNotNull(result);
        assertEquals(IQ.Type.ERROR, result.getType());
        assertEquals(SERVER_DOMAIN, result.getFrom());
        assertEquals(TEST_USERNAME1, result.getTo());
        assertEquals("service-unavailable", result.getError().getCondition());
    }
View Full Code Here

          return;
        if (!info.containsFeature("jabber:iq:register"))
          return;
        Registration reg = new Registration();
        reg.setTo(addressid);
        IQ result;
        try {
          result = account.xmpp.sendIQPacketAndWaitForReply(reg);
        } catch (XMPPException e) {
          e.printStackTrace();
          ErrorDialog.openError(sShell,"Error while retrieving registration information","Could not retrieve registration information from " + reg.getFrom() + ": " + e.getLocalizedMessage(),new Status(IStatus.ERROR,GOIMPlugin.ID,IStatus.OK,"Error while retrieving registration information.",e));
View Full Code Here

        if(reg != null)
          registration.addExtension(reply.getDataFormToSend());
      }
      if(reg == null) { close(); return; }
      registration.setAttributes(attributes);
      @SuppressWarnings("unused") IQ result;
      try {
        result = account.xmpp.sendIQPacketAndWaitForReply(registration);
      } catch (XMPPException e) {
        e.printStackTrace();
        ErrorDialog.openError(dialogArea.getShell(),"Error while registering","Could not register with " + reg.getFrom() + ": " + e.getLocalizedMessage(),new Status(IStatus.ERROR,GOIMPlugin.ID,IStatus.OK,"Error while registering",e));
View Full Code Here

            System.out.println("Registered as " + writerAddress);

            // Look for the reader process.
            System.out.print("Looking for " + readerAddress + "...");
            while (true) {
                IQ testIQ = new Time();
                testIQ.setType(IQ.Type.GET);
                testIQ.setTo(readerAddress);
                PacketCollector collector = con.createPacketCollector(new PacketIDFilter(testIQ.getPacketID()));
                con.sendPacket(testIQ);
                // Wait 5 seconds.
                long start = System.currentTimeMillis();
                Packet result = collector.nextResult(5000);
                collector.cancel();
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.packet.IQ

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.