Package org.apache.vysper.xmpp.protocol

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


        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

        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

        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

            StanzaHandler stanzaHandler) {
        boolean proceed = checkState(sessionContext, sessionStateHolder, stanza, stanzaHandler);
        if (!proceed)
            return; // TODO close stream?

        ResponseStanzaContainer responseStanzaContainer = executeHandler(sessionContext, sessionStateHolder, stanza,
                stanzaHandler);

        writeResponse(sessionContext, responseStanzaContainer);
    }
View Full Code Here

        }
    }

    protected ResponseStanzaContainer executeHandler(SessionContext sessionContext,
            SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
        ResponseStanzaContainer responseStanzaContainer = null;
        try {
            responseStanzaContainer = stanzaHandler.execute(stanza, sessionContext.getServerRuntimeContext(),
                    isProcessingOutboundStanzas(), sessionContext, sessionStateHolder);
        } catch (ProtocolException e) {
            ResponseWriter.handleProtocolError(e, sessionContext, stanza);
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.