Examples of XMPPError


Examples of org.jivesoftware.smack.packet.XMPPError

                    /*
                     * check if sequence was not used already (see XEP-0047 Section 2.2)
                     */
                    if (data.getSeq() <= this.lastSequence) {
                        IQ unexpectedRequest = IQ.createErrorResponse((IQ) packet, new XMPPError(
                                        XMPPError.Condition.unexpected_request));
                        connection.sendPacket(unexpectedRequest);
                        return;

                    }

                    // check if encoded data is valid (see XEP-0047 Section 2.2)
                    if (data.getDecodedData() == null) {
                        // data is invalid; respond with bad-request error
                        IQ badRequest = IQ.createErrorResponse((IQ) packet, new XMPPError(
                                        XMPPError.Condition.bad_request));
                        connection.sendPacket(badRequest);
                        return;
                    }

View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

     *
     * @throws XMPPException XMPP exception containing the XMPP error
     */
    private void cancelRequest() throws XMPPException {
        String errorMessage = "Could not establish socket with any provided host";
        XMPPError error = new XMPPError(XMPPError.Condition.item_not_found, errorMessage);
        IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
        this.manager.getConnection().sendPacket(errorIQ);
        throw new XMPPException(errorMessage, error);
    }
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

        if (jingleError != null) {
            errorPacket = createIQ(getSid(), iq.getFrom(), iq.getTo(), IQ.Type.ERROR);

            List<PacketExtension> extList = new ArrayList<PacketExtension>();
            extList.add(jingleError);
            XMPPError error = new XMPPError(0, XMPPError.Type.CANCEL, jingleError.toString(), "", extList);

            // Fill in the fields with the info from the Jingle packet
            errorPacket.setPacketID(iq.getPacketID());
            errorPacket.setError(error);
            //            errorPacket.addExtension(jingleError);
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

        try {
            result = (VCard) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

            if (result == null) {
                String errorMessage = "Timeout getting VCard information";
                throw new XMPPException(errorMessage, new XMPPError(
                        XMPPError.Condition.request_timeout, errorMessage));
            }
            if (result.getError() != null) {
                throw new XMPPException(result.getError());
            }
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

     */
    @Test
    public void shouldFailIfActivateSocks5ProxyFails() throws Exception {

        // build error response as reply to the stream activation
        XMPPError xmppError = new XMPPError(XMPPError.Condition.interna_server_error);
        IQ error = new IQ() {

            public String getChildElementXML() {
                return null;
            }
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

        // return stream host info if it is queried
        protocol.addResponse(streamHostInfo, Verification.correspondingSenderReceiver,
                        Verification.requestTypeGET);

        // build error packet to reject SOCKS5 Bytestream
        XMPPError xmppError = new XMPPError(XMPPError.Condition.no_acceptable);
        IQ rejectPacket = new IQ() {

            public String getChildElementXML() {
                return null;
            }
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

    @Test
    public void shouldFailIfTargetDoesNotSupportIBB() {
        InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);

        try {
            XMPPError xmppError = new XMPPError(
                            XMPPError.Condition.feature_not_implemented);
            IQ errorIQ = IBBPacketUtils.createErrorIQ(targetJID, initiatorJID, xmppError);
            protocol.addResponse(errorIQ);

            // start In-Band Bytestream
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

    {
      node.send(new Item());
      fail("Exception should be thrown when there is no payload");
    }
    catch (XMPPException e) {
      XMPPError err = e.getXMPPError();
      assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
      assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
      assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
    }

    try
    {
      node.send(new Item("test" + System.currentTimeMillis()));
      fail("Exception should be thrown when there is no payload");
    }
    catch (XMPPException e) {
      XMPPError err = e.getXMPPError();
      assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
      assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
      assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
    }
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

    {
      node.send(new Item());
      fail("Exception should be thrown when there is no payload");
    }
    catch (XMPPException e) {
      XMPPError err = e.getXMPPError();
      assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
      assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
      assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
    }

    try
    {
      node.send(new Item("test" + System.currentTimeMillis()));
      fail("Exception should be thrown when there is no payload");
    }
    catch (XMPPException e) {
      XMPPError err = e.getXMPPError();
      assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
      assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
      assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
    }
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.XMPPError

            try {
                muc3.join("MyNick");
                fail("Other user was able to join with other user's reserved nickname");
            }
            catch (XMPPException e) {
                XMPPError xmppError = e.getXMPPError();
                assertNotNull(
                    "No XMPPError was received when joining with other user's reserved nickname",
                    xmppError);
                assertEquals(
                    "Different error code was received while joining with other user's reserved nickname",
                    409,
                    xmppError.getCode());
            }

            // Check that user3 can join the room using his own nickname (not reserved)
            muc3.join("MyNotReservedNick");
            muc3.leave();

            // Check that another user cannot reserve an already reserved nickname
            registrationForm = muc3.getRegistrationForm();
            answerForm = registrationForm.createAnswerForm();
            answerForm.setAnswer("muc#register_first", "MyFirstName 2");
            answerForm.setAnswer("muc#register_last", "MyLastName 2");
            answerForm.setAnswer("muc#register_roomnick", "MyNick");
            try {
                muc3.sendRegistrationForm(answerForm);
            }
            catch (XMPPException e) {
                XMPPError xmppError = e.getXMPPError();
                assertNotNull(
                    "No XMPPError was received when reserving an already reserved nickname",
                    xmppError);
                assertEquals(
                    "Different error code was received while reserving an already reserved nickname",
                    409,
                    xmppError.getCode());
            }

            // Check that another user can reserve a new nickname
            registrationForm = muc3.getRegistrationForm();
            answerForm = registrationForm.createAnswerForm();
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.