Package org.apache.vysper.xmpp.server

Examples of org.apache.vysper.xmpp.server.XMPPVersion


    }

    public void testProcessClientStreamOpeningResponse_IllegalVersion() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = new IllegalXMPPVersion("IllV1.0");
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertTrue(responseVerifier.nameEquals("error"));
        assertTrue("error", responseVerifier.subElementPresent(StreamErrorCondition.UNSUPPORTED_VERSION.value()));
View Full Code Here


    }

    public void testProcessClientStreamOpeningResponse_Version_2_0() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = new XMPPVersion(2, 0);
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertTrue(responseVerifier.nameEquals("error"));
        assertTrue("error", responseVerifier.subElementPresent(StreamErrorCondition.UNSUPPORTED_VERSION.value()));
View Full Code Here

        // processing xml:lang
        String xmlLang = stanza.getXMLLang();
        sessionContext.setXMLLang(xmlLang);

        // processing version
        XMPPVersion responseVersion = null;
        // if version is not present, version "0.0" is assumed, represented by NULL.
        String versionAttributeValue = stanza.getAttributeValue("version");
        if (versionAttributeValue != null) {
            XMPPVersion clientVersion;
            try {
                clientVersion = new XMPPVersion(versionAttributeValue);
            } catch (IllegalArgumentException e) {
                // version string does not conform to spec
                return respondUnsupportedVersionError(xmlLang, versionAttributeValue, "illegal version value: ");
            }
            // check if version is supported
            if (!clientVersion.equals(XMPPVersion.VERSION_1_0)) {
                if (clientVersion.getMajor() == XMPPVersion.VERSION_1_0.getMajor()) {
                    // we live with the higher minor version, but only support ours
                    responseVersion = XMPPVersion.VERSION_1_0;
                } else {
                    // we do not support major changes, as of RFC3920
                    return respondUnsupportedVersionError(xmlLang, versionAttributeValue,
View Full Code Here

    }

    public void testProcessClientStreamOpeningResponse_Version_1_0() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = XMPPVersion.VERSION_1_0;
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertTrue(responseVerifier.attributeEquals("version", XMPPVersion.VERSION_1_0.toString()));
        assertTrue(responseVerifier.attributePresent("id"));
View Full Code Here

    }

    public void testProcessClientStreamOpeningResponse_NoVersion() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = null;
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertFalse(responseVerifier.attributePresent("version"));
        assertFalse("no error", responseVerifier.subElementPresent("error"));
View Full Code Here

    }

    public void testProcessClientStreamOpeningResponse_Version_1_1() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = new XMPPVersion(1, 1);
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertTrue(responseVerifier.attributeEquals("version", XMPPVersion.VERSION_1_0.toString()));
        assertFalse("no error", responseVerifier.subElementPresent("error"));
View Full Code Here

    }

    public void testProcessClientStreamOpeningResponse_IllegalVersion() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = new IllegalXMPPVersion("IllV1.0");
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertTrue(responseVerifier.nameEquals("error"));
        assertTrue("error", responseVerifier.subElementPresent(StreamErrorCondition.UNSUPPORTED_VERSION.value()));
View Full Code Here

    }

    public void testProcessClientStreamOpeningResponse_Version_2_0() {
        sessionContext.setSessionState(getDefaultState());

        XMPPVersion versionSent = new XMPPVersion(2, 0);
        Stanza response = getVersionResponse(versionSent);

        XMLElementVerifier responseVerifier = response.getVerifier();
        assertTrue(responseVerifier.nameEquals("error"));
        assertTrue("error", responseVerifier.subElementPresent(StreamErrorCondition.UNSUPPORTED_VERSION.value()));
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.server.XMPPVersion

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.