Package org.apache.vysper.xmpp.parser

Examples of org.apache.vysper.xmpp.parser.StringStreamParser


/**
*/
public class ServerResponsesTestCase extends TestCase {

    public void testFeaturesForAuthentication() throws ParsingException {
        StringStreamParser parser = new StringStreamParser(
                "<features>" +
                  "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>" +
                    "<mechanism>EXTERNAL</mechanism>" +
                    "<mechanism>PLAIN</mechanism>" +
                    "<mechanism>ANONYMOUS</mechanism>" +
                  "</mechanisms>" +
                "</features>");

        Stanza stanza = parser.getNextStanza();


        List<SASLMechanism> mechanismList = new ArrayList<SASLMechanism>();
        mechanismList.add(new External());
        mechanismList.add(new Plain());
View Full Code Here


        sessionContext = new TestSessionContext(context, sessionStateHolder);
    }

    public void testAquireSimpleStanza() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler xmlns='testNSURI' ></ProtocolHandlerTestStanzaHandler>");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNotNull(stanza);

        Stanza expectedStanza = new StanzaBuilder("ProtocolHandlerTestStanzaHandler", "testNSURI").addNamespaceAttribute("testNSURI").build();
        assertEquals("stanza full match", expectedStanza, stanza);
View Full Code Here

    }

    public void testAquireXMLNotWellformedStanza() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler><inner_not_closed></ProtocolHandlerTestStanzaHandler>");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNull(stanza);

        assertErrorResponse();
View Full Code Here

    }

    public void testAquireXMLIncomplete() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler></Pro");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNull(stanza);

        assertErrorResponse();
View Full Code Here

        assertTrue("bad format", recordedResponse.getVerifier().subElementPresent("bad-format"));
    }

    public void testAquireNoNextStanza() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler ></ProtocolHandlerTestStanzaHandler>");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNotNull(stanza);

        stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNull("no next", stanza);
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.parser.StringStreamParser

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.