Package org.apache.vysper.xmpp.protocol

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


        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(boundClient, server, IQStanzaType.GET, IQ_ID);
        stanzaBuilder.startInnerElement("ping", NamespaceURIs.URN_XMPP_PING).endInnerElement();

        Stanza requestStanza = stanzaBuilder.build();
        ResponseStanzaContainer resp = handler.execute(requestStanza, sessionContext.getServerRuntimeContext(), true,
                sessionContext, null);

        // we should always get a response
        assertTrue(resp.hasResponse());

        Stanza respStanza = resp.getResponseStanza();

        assertEquals("iq", respStanza.getName());
        assertEquals(boundClient, respStanza.getTo());
        assertEquals(server, respStanza.getFrom());
        assertEquals(IQ_ID, respStanza.getAttributeValue("id"));
View Full Code Here


        assertTrue("tls init", sessionContext.isSwitchToTLSCalled());
    }

    private Stanza executeStartTLSHandler(Stanza starttlsStanza, TestSessionContext sessionContext) {
        StartTLSHandler startTLSHandler = new StartTLSHandler();
        ResponseStanzaContainer responseStanzaContainer = startTLSHandler.execute(starttlsStanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
        Stanza responseStanza = responseStanzaContainer.getResponseStanza();
        return responseStanza;
    }
View Full Code Here

    public void testAuthPlainNoInitialResponse() throws AuthorizationFailedException {
        StanzaBuilder stanzaBuilder = createAuthPlain();
        Stanza authPlainStanza = stanzaBuilder.build();

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

        assertTrue(responseContainer.getResponseStanza().getVerifier().nameEquals("failure"));
        assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
    }
View Full Code Here

        StanzaBuilder stanzaBuilder = createAuthPlain();
        stanzaBuilder.addText("=");
        Stanza authPlainStanza = stanzaBuilder.build();

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

        assertTrue(responseContainer.getResponseStanza().getVerifier().nameEquals("failure"));
        assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
    }
View Full Code Here

        Stanza authPlainStanza = stanzaBuilder.build();

        assertEquals(3, AuthorizationRetriesCounter.getFromSession(sessionContext).getTriesLeft());

        AuthHandler authHandler = new AuthHandler();
        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
        Stanza responseStanza = responseContainer.getResponseStanza();

        assertTrue(responseStanza.getVerifier().nameEquals("success"));
        assertTrue(sessionStateHolder.getState() == SessionState.AUTHENTICATED);
        assertNull(sessionContext.getAttribute(AuthorizationRetriesCounter.SESSION_ATTRIBUTE_ABORTION_COUNTER));
    }
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.addText(new String(Base64.encodeBase64("dummy\0user008\0pass007".getBytes())));

        Stanza authPlainStanza = stanzaBuilder.build();

        AuthHandler authHandler = new AuthHandler();
        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
        Stanza responseStanza = responseContainer.getResponseStanza();
        return responseStanza;
    }
View Full Code Here

        assertNull(receiverUser.getNextStanza()); // nothing there yet
        assertNull(senderUser.getNextStanza()); // nothing there yet

        Stanza stanza = stanzaBuilder.build();
        ResponseStanzaContainer responseStanzaContainer = messageHandler.execute(stanza, senderSessionContext
                .getServerRuntimeContext(), true, senderSessionContext, null);

        Stanza receivedStanza = receiverUser.getNextStanza();
        XMLElementVerifier timestampVerifier = receivedStanza.getFirstInnerElement().getVerifier();
View Full Code Here

        StanzaReceiverQueue receiverQueue = new StanzaReceiverQueue();
        stanzaRelay.add(sender, senderQueue);
        stanzaRelay.add(receiver, receiverQueue);

        Stanza successfulMessageStanza = StanzaBuilder.createMessageStanza(sender, receiver, "en", "info").build();
        ResponseStanzaContainer responseStanzaContainer = messageHandler.execute(successfulMessageStanza,
                senderSessionContext.getServerRuntimeContext(), true, senderSessionContext, null);
        assertEquals(successfulMessageStanza, receiverQueue.getNext());

        Stanza failureMessageStanza = StanzaBuilder.createMessageStanza(sender, noReceiver, "en", "info").build();
        responseStanzaContainer = messageHandler.execute(failureMessageStanza, senderSessionContext
View Full Code Here

    public void testIQClientToClient_Outbound_NotSubscribed() {
        Stanza iqStanza = StanzaBuilder.createIQStanza(initiatingUser.getEntityFQ(), unrelatedUser.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?*/);
        XMPPCoreStanza response = XMPPCoreStanza.getWrapper(stanzaContainer.getResponseStanza());
        assertNotNull(response);
        assertTrue(response.isError());
    }
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.