Package org.apache.vysper.xmpp.protocol

Examples of org.apache.vysper.xmpp.protocol.ResponseStanzaContainer


    public void testIQClientToClient_Outbound() {
        Stanza iqStanza = StanzaBuilder.createIQStanza(initiatingUser.getEntityFQ(), subscribed_FROM.getEntityFQ(),
                IQStanzaType.GET, "test").startInnerElement("mandatory", NamespaceURIs.JABBER_CLIENT).build();

        ResponseStanzaContainer stanzaContainer = relayingIQHandler.execute(iqStanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, null /*don't we have as sessionStateHolder?*/);
        assertNull(stanzaContainer);
        Stanza deliveredStanza = subscribed_FROM.getNextStanza();
        assertTrue(deliveredStanza.getVerifier().onlySubelementEquals("mandatory", NamespaceURIs.JABBER_CLIENT));
        assertEquals(subscribed_FROM.getEntityFQ(), deliveredStanza.getTo());
View Full Code Here


    public void testIQClientToClient_Inbound_NoTO() {
        Stanza iqStanza = StanzaBuilder.createIQStanza(subscribed_FROM.getEntityFQ(), initiatingUser.getEntityFQ(),
                IQStanzaType.GET, "test").startInnerElement("mandatory", NamespaceURIs.JABBER_CLIENT).build();

        ResponseStanzaContainer stanzaContainer = relayingIQHandler.execute(iqStanza, sessionContext
                .getServerRuntimeContext(), false, sessionContext, null /*don't we have as sessionStateHolder?*/);
        XMPPCoreStanza response = XMPPCoreStanza.getWrapper(stanzaContainer.getResponseStanza());
        assertNotNull(response);
        assertTrue(response.isError());
    }
View Full Code Here

    public void testIQClientToClient_Inbound() {
        Stanza iqStanza = StanzaBuilder.createIQStanza(subscribed_TO.getEntityFQ(), initiatingUser.getEntityFQ(),
                IQStanzaType.GET, "test").startInnerElement("mandatory", NamespaceURIs.JABBER_CLIENT).build();

        ResponseStanzaContainer stanzaContainer = relayingIQHandler.execute(iqStanza, sessionContext
                .getServerRuntimeContext(), false, sessionContext, null /*don't we have as sessionStateHolder?*/);
        assertNull(stanzaContainer);
        Stanza deliveredStanza = sessionContext.getNextRecordedResponse();
        assertTrue(deliveredStanza.getVerifier().onlySubelementEquals("mandatory", NamespaceURIs.JABBER_CLIENT));
        assertEquals(initiatingUser.getEntityFQ(), deliveredStanza.getTo());
View Full Code Here

        stanzaBuilder.addAttribute("mechanism", "plain"); // 'PLAIN' would be correct
        Stanza authPlainStanza = stanzaBuilder.build();

        AuthHandler authHandler = new AuthHandler();
        try {
            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza, sessionContext
                    .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);

            fail("should raise exception");
        } catch (RuntimeException e) {
            // test succeeded
View Full Code Here

        stanzaBuilder.addAttribute("mechanism", "EXTERNAL");
        Stanza authPlainStanza = stanzaBuilder.build();

        AuthHandler authHandler = new AuthHandler();
        try {
            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza, sessionContext
                    .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);

            fail("should raise exception");
        } catch (RuntimeException e) {
            // test succeeded
View Full Code Here

        TestSessionContext sessionContext = this.sessionContext;
        sessionContext.setServerToServer();

        TestIQHandler iqHandler = new TestIQHandler();
        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanzaBuilder.build(), sessionContext
                .getServerRuntimeContext(), true, sessionContext, null);
        Stanza responseStanza = responseStanzaContainer.getResponseStanza();
        XMLElementVerifier verifier = responseStanza.getVerifier();
        assertTrue("error", verifier.nameEquals("error"));
    }
View Full Code Here

        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaBuilder.addAttribute("type", "error");
        Stanza stanza = stanzaBuilder.build(); // this stanza has no ID

        IQHandler iqHandler = new IQHandler();
        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, null);
        Stanza responseStanza = responseStanzaContainer.getResponseStanza();
        XMLElementVerifier verifier = responseStanza.getVerifier();
        assertTrue("error", verifier.nameEquals("error")); // response is _not_ IQ stanza
    }
View Full Code Here

        Stanza authPlainStanza = stanzaBuilder.build();

        // correct credential no longer work - no retries left
        AuthHandler authHandler = new AuthHandler();
        try {
            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza, sessionContext
                    .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
            fail("should raise error - no tries left");
        } catch (AuthorizationFailedException e) {
            // test succeeded
        }
View Full Code Here

        StanzaBuilder stanzaBuilder = createAbort();

        Stanza abortStanza = stanzaBuilder.build();

        AbortHandler abortHandler = new AbortHandler();
        ResponseStanzaContainer responseContainer = abortHandler.execute(abortStanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
        Stanza responseStanza = responseContainer.getResponseStanza();
        return responseStanza;
    }
View Full Code Here

        assertTrue("error", verifier.nameEquals("error")); // response is _not_ IQ stanza
    }

    private void assertIQError(Stanza stanza) {
        TestIQHandler iqHandler = new TestIQHandler();
        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, null);
        Stanza responseStanza = responseStanzaContainer.getResponseStanza();
        XMLElementVerifier verifier = responseStanza.getVerifier();
        assertTrue("iq", verifier.nameEquals("iq"));
        assertTrue("error type", verifier.attributeEquals("type", IQStanzaType.ERROR.value()));
        assertTrue("iq-error", verifier.subElementPresent("error"));
    }
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.protocol.ResponseStanzaContainer

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.