Package org.apache.vysper.xmpp.protocol

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


     * Creates a new context for a session
     * @param boshHandler
     * @param serverRuntimeContext
     */
    public BoshBackedSessionContext(BoshHandler boshHandler, ServerRuntimeContext serverRuntimeContext) {
        super(serverRuntimeContext, new SessionStateHolder());

        // in BOSH we jump directly to the encrypted state
        sessionStateHolder.setState(SessionState.ENCRYPTED);

        this.boshHandler = boshHandler;
View Full Code Here


        handler = getHandler();
    }
   
    protected TestSessionContext createTestSessionContext(Entity serverEntity) {
        SessionStateHolder sessionStateHolder = new SessionStateHolder();
        sessionStateHolder.setState(SessionState.AUTHENTICATED);
        relay = new org.apache.vysper.xmpp.delivery.StanzaReceiverRelay();
        DefaultServerRuntimeContext serverContext = new DefaultServerRuntimeContext(serverEntity, relay);
        relay.setServerRuntimeContext(serverContext);
        TestSessionContext tsc = new TestSessionContext(serverContext, sessionStateHolder);
View Full Code Here

    /**
     * returns a new session for the server. the session behaves like a client, but lives within the server JVM
     */
    public StanzaSession createNewSession() {
        SessionStateHolder stateHolder = new SessionStateHolder();
        stateHolder.setState(SessionState.INITIATED);
        StanzaSessionContext sessionContext = new StanzaSessionContext(serverRuntimeContext, stateHolder);
        StanzaSession session = new StanzaSession(sessionContext);
        return session;
    }
View Full Code Here

        IQHandler infoIQHandler = createDiscoIQHandler();

        StanzaBuilder request = buildRequest();
       
        ResponseStanzaContainer resultStanzaContainer = infoIQHandler.execute(request.build(), serverRuntimeContext, false, new TestSessionContext(serverRuntimeContext, new SessionStateHolder()), null);
        Stanza resultStanza = resultStanzaContainer.getResponseStanza();

        assertEquals("Disco request must not return error", "result", resultStanza.getAttributeValue("type"));
        XMLElement queryElement = resultStanza.getFirstInnerElement();
       
View Full Code Here

        assertResponse(response, "malformed-request");
    }

    private Stanza startMechanism(Stanza finalStanza) {
        Plain plain = new Plain();
        stateHolder = new SessionStateHolder();
        Stanza response = plain.started(new TestSessionContext(stateHolder), stateHolder, finalStanza);
        return response;
    }
View Full Code Here

     * creates a new session context (but doesn't set the runtime context)
     * @param entity
     * @return
     */
    public static TestSessionContext createSessionContext(Entity entity) {
        SessionStateHolder sessionStateHolder = new SessionStateHolder();
        TestSessionContext sessionContext = new TestSessionContext(sessionStateHolder);
        if (entity != null) sessionContext.setInitiatingEntity(entity.getBareJID());
        return sessionContext;
    }
View Full Code Here

    /**
     * creates a new authenticated session and a new runtime context
     * @return
     */
    public static TestSessionContext createWithStanzaReceiverRelayAuthenticated() {
        SessionStateHolder sessionStateHolder = new SessionStateHolder();
        sessionStateHolder.setState(SessionState.AUTHENTICATED);
        return createWithStanzaReceiverRelay(sessionStateHolder);
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();
       
        // sender
        senderSessionContext = TestSessionContext.createWithStanzaReceiverRelay(new SessionStateHolder());
        sender = EntityImpl.parse("sender@vysper.org");
        senderSessionContext.setInitiatingEntity(sender);
        senderUser = TestUser.createForSession(senderSessionContext, sender);
       
        // receiver
        receiverSessionContext = TestSessionContext.createWithStanzaReceiverRelay(new SessionStateHolder(), senderSessionContext.getServerRuntimeContext());
        receiver = EntityImpl.parse("receiver@vysper.org");
        receiverSessionContext.setInitiatingEntity(receiver);
        receiverUser = TestUser.createForSession(receiverSessionContext, receiver, false);
    }
View Full Code Here

        StanzaBuilder request = StanzaBuilder.createIQStanza(EntityImpl.parse("user@vysper.org"), EntityImpl.parse("info@vysper.org"), IQStanzaType.GET, "1");

        IQStanza finalStanza = (IQStanza)XMPPCoreStanza.getWrapper(request.build());
       
        Stanza resultStanza = infoIQHandler.handleGet(finalStanza, runtimeContext, new TestSessionContext(runtimeContext, new SessionStateHolder()));

        assertTrue(resultStanza.getVerifier().onlySubelementEquals("query", NamespaceURIs.XEP0030_SERVICE_DISCOVERY_INFO));
        XMLElement queryElement = resultStanza.getFirstInnerElement();
        XMLElementVerifier queryVerifier = queryElement.getVerifier();
        assertTrue(queryVerifier.subElementsPresentExact(4));
View Full Code Here

            return;
        }

        Stanza stanza = (Stanza) message;
        SessionContext session = extractSession(ioSession);
        SessionStateHolder stateHolder = (SessionStateHolder) ioSession.getAttribute(ATTRIBUTE_VYSPER_SESSIONSTATEHOLDER);

        serverRuntimeContext.getStanzaProcessor().processStanza(serverRuntimeContext, session, stanza, stateHolder);
    }
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.protocol.SessionStateHolder

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.