Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.Stanza


        return new DefaultSubscribeStanzaGenerator();
    }

    public void testSubscribe() throws Exception {
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(),response.getType());
        assertTrue(node.isSubscribed(client));
View Full Code Here


   
    public void testSubscribeNoFrom() throws Exception {
        DefaultSubscribeStanzaGenerator sg = (DefaultSubscribeStanzaGenerator)getDefaultStanzaGenerator();
        sg.overrideSubscriberJID(client.getFullQualifiedName());
       
        Stanza stanza = sg.getStanza(null, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(),response.getType());
        assertTrue(node.isSubscribed(client));
View Full Code Here

        if (to != null) {
            // TODO ensure, that RFC3920 9.1.1 "If the value of the 'to' attribute is invalid or cannot be contacted..." is enforced
        }

        Stanza responseStanza = executeCore(stanza, serverRuntimeContext, isOutboundStanza, sessionContext);

        if (responseStanza != null) return new ResponseStanzaContainerImpl(responseStanza);

        return null;
    }
View Full Code Here

                break;
            }
        }
        if (identifiedMechanism == null) throw new RuntimeException("return error");

        Stanza responseStanza = identifiedMechanism.started(sessionContext, sessionStateHolder, stanza);
        if (sessionStateHolder.getState() == SessionState.AUTHENTICATED) {
            AuthorizationRetriesCounter.removeFromSession(sessionContext);
        } else {
            AuthorizationRetriesCounter.getFromSession(sessionContext).countFailedTry();
        }
View Full Code Here

        assertNotNull(root.find(testNode));
        // make sure we have 4 subscribers
        assertEquals(4, node.countSubscriptions());
       
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(),response.getType());
View Full Code Here

       
        assertNotNull(root.find(testNode));
        Entity clientNotAuthorized = new EntityImpl("darthvader", "deathstar.tld", null);
       
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(clientNotAuthorized, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
View Full Code Here

    public void testDeleteNoSuchNode() throws Exception {
        String testNode = "test";
        assertNull(root.find(testNode));
       
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
View Full Code Here

        if (xmlElementVerifier.attributePresent("id")) {
            // ignore silently (see RFC3920 4.4)
        }

        Stanza responseStanza = null;
        if (clientCall) {
            // RFC3920: 'to' attribute SHOULD be used by the initiating entity
            String toValue = stanza.getAttributeValue("to");
            if (toValue != null) {
                EntityImpl toEntity = null;
View Full Code Here

                                                        null));
    }

    private ResponseStanzaContainer respondUnsupportedVersionError(String xmlLang, String versionAttributeValue, String errorMessage) {
        if (xmlLang == null) xmlLang = "en_US";
        Stanza error = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_VERSION, xmlLang,
                errorMessage + versionAttributeValue, null);
        return new ResponseStanzaContainerImpl(error);
    }
View Full Code Here

        }
        if (sessionStateHolder.getState() != SessionState.STARTED) {
            return respondTLSFailure();
        }

        Stanza responseStanza = new ServerResponses().getTLSProceed();

        // if all is correct, go to next phase
        sessionStateHolder.setState(SessionState.ENCRYPTION_STARTED);

        sessionContext.switchToTLS();
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.stanza.Stanza

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.