Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.PacketCollector.cancel()


          conn.sendPacket(iq);

          // Wait up to 5 seconds for a result.
          IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
          // Stop queuing results
          collector.cancel();
          if (result == null) {
              throw new XMPPException("No response from the server.");
          }
          if (result.getType() == IQ.Type.ERROR) {
              throw new XMPPException(result.getError());
View Full Code Here


        .createPacketCollector(filter);
    conn.sendPacket(reg);
    IQ result = (IQ) collector.nextResult(SmackConfiguration
        .getPacketReplyTimeout());
    // Stop queuing results
    collector.cancel();
        if (result == null) {
            throw new XMPPException("No response from server.");
        }
        else if (result.getType() == IQ.Type.ERROR) {
            throw new XMPPException(result.getError());
View Full Code Here

        address3 = ((MultipleAddresses.Address) addresses3.get(0)).getJid();
        assertEquals("Incorrect CC address", getBareJID(2), address3);

        collector1.cancel();
        collector2.cancel();
        collector3.cancel();
    }

    /**
     * Ensures that replying to packets is ok.
     */
 
View Full Code Here

        assertNull("Connection2 received 2 messages", message1);

        collector0.cancel();
        collector1.cancel();
        collector2.cancel();
        collector3.cancel();
    }

    /**
     * Ensures that replying is not allowed when disabled.
     */
 
View Full Code Here

        message1 = (Message) collector3.nextResult(SmackConfiguration.getPacketReplyTimeout());
        assertNull("Connection2 received 2 messages", message1);

        collector1.cancel();
        collector2.cancel();
        collector3.cancel();
    }

    protected int getMaxConnections() {
        return 4;
    }
View Full Code Here

        connection.sendPacket(data);

        Packet response = collector.nextResult(timeout);

        // Cancel the collector.
        collector.cancel();
        if (response == null) {
            throw new XMPPException("No response from server on status set.");
        }
        if (response.getError() != null) {
            throw new XMPPException(response.getError());
View Full Code Here

        connection.sendPacket(privateDataGet);

        // Wait up to five seconds for a response from the server.
        IQ response = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        // Stop queuing results
        collector.cancel();
        if (response == null) {
            throw new XMPPException("No response from the server.");
        }
        // If the server replied with an error, throw an exception.
        else if (response.getType() == IQ.Type.ERROR) {
View Full Code Here

        connection.sendPacket(privateDataSet);

        // Wait up to five seconds for a response from the server.
        IQ response = (IQ)collector.nextResult(5000);
        // Stop queuing results
        collector.cancel();
        if (response == null) {
            throw new XMPPException("No response from the server.");
        }
        // If the server replied with an error, throw an exception.
        else if (response.getType() == IQ.Type.ERROR) {
View Full Code Here

        connection.sendPacket(info);

        // Wait up to 5 seconds for a result.
        IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        // Stop queuing results
        collector.cancel();
        if (result == null) {
            throw new XMPPException("No response from the server.");
        }
        if (result.getType() == IQ.Type.ERROR) {
            throw new XMPPException(result.getError());
View Full Code Here

        catch (XMPPException ex) {
            fail(ex.getMessage());
        }
        finally {
            collector.cancel();
            collector2.cancel();
        }
    }

    protected int getMaxConnections() {
        return 2;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.