Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.StanzaBuilder.addText()


            for (Attribute a : x.getAttributes()) {
                stanzaBuilder.addAttribute(a);
            }
            stanzaBuilder.endInnerElement();
        } else {
            stanzaBuilder.addText(privateDataXML);
        }
        return stanzaBuilder.build();
    }

    /**
 
View Full Code Here


            }
            return stanzaBuilder.build();
        }

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(stanza.getTo(), stanza.getFrom(), IQStanzaType.RESULT, stanza.getID());
        stanzaBuilder.addText(vcardXml);
        return stanzaBuilder.build();
    }
}
View Full Code Here

        assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
    }

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

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

        assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
    }

    public void testAuthPlainAuthorizedCredentialsResponse() throws XMLSemanticError, AuthorizationFailedException {
        StanzaBuilder stanzaBuilder = createAuthPlain();
        stanzaBuilder.addText(new String(Base64.encodeBase64("dummy\0user007\0pass007".getBytes())));
       
        Stanza authPlainStanza = stanzaBuilder.build();

        assertEquals(3, AuthorizationRetriesCounter.getFromSession(sessionContext).getTriesLeft());
View Full Code Here

    public void testAuthPlainWrongCredentialsResponse() throws XMLSemanticError, AuthorizationFailedException {

        executeWrongPlainAuthorization_3Times();
       
        StanzaBuilder stanzaBuilder = createAuthPlain();
        stanzaBuilder.addText(new String(Base64.encodeBase64("dummy\0user007\0pass007".getBytes())));
        Stanza authPlainStanza = stanzaBuilder.build();

        // correct credential no longer work - no retries left
        AuthHandler authHandler = new AuthHandler();
        try {
View Full Code Here

        assertEquals(0, AuthorizationRetriesCounter.getFromSession(sessionContext).getTriesLeft());
    }

    private Stanza executeWrongPlainAuthorization() throws AuthorizationFailedException {
        StanzaBuilder stanzaBuilder = createAuthPlain();
        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);
View Full Code Here

        StanzaBuilder stanzaBuilder = createAbort();
        Stanza abortPlainStanza = stanzaBuilder.build();

        stanzaBuilder = new StanzaBuilder("auth", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
        stanzaBuilder.addAttribute("mechanism", "PLAIN");
        stanzaBuilder.addText(new String(Base64.encodeBase64("dummy\0user007\0pass007".getBytes())));
        Stanza authPlainStanza = stanzaBuilder.build();

        // correct credential no longer work - no retries left
        AuthHandler authHandler = new AuthHandler();
        try {
View Full Code Here

        assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
    }

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

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

        assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
    }

    public void testAuthPlainAuthorizedCredentialsResponse() throws XMLSemanticError, AuthorizationFailedException {
        StanzaBuilder stanzaBuilder = createAuthPlain();
        stanzaBuilder.addText(new String(Base64.encodeBase64("dummy\0user007\0pass007".getBytes())));

        Stanza authPlainStanza = stanzaBuilder.build();

        assertEquals(3, AuthorizationRetriesCounter.getFromSession(sessionContext).getTriesLeft());
View Full Code Here

    public void testAuthPlainWrongCredentialsResponse() throws XMLSemanticError, AuthorizationFailedException {

        executeWrongPlainAuthorization_3Times();

        StanzaBuilder stanzaBuilder = createAuthPlain();
        stanzaBuilder.addText(new String(Base64.encodeBase64("dummy\0user007\0pass007".getBytes())));
        Stanza authPlainStanza = stanzaBuilder.build();

        // correct credential no longer work - no retries left
        AuthHandler authHandler = new AuthHandler();
        try {
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.