Package org.apache.vysper.xmpp.protocol

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


    }

    private void messageReceivedNoStanza(IoSession ioSession, Object message) {
        if (message == SslFilter.SESSION_SECURED) {
            SessionContext session = extractSession(ioSession);
            SessionStateHolder stateHolder = (SessionStateHolder) ioSession.getAttribute(ATTRIBUTE_VYSPER_SESSIONSTATEHOLDER);
            serverRuntimeContext.getStanzaProcessor().processTLSEstablished(session, stateHolder);
            return;
        } else if (message == SslFilter.SESSION_UNSECURED) {
            // TODO
            return;
View Full Code Here


    public void messageSent(IoSession ioSession, Object o) throws Exception {
        // TODO implement
    }

    public void sessionCreated(IoSession ioSession) throws Exception {
        SessionStateHolder stateHolder = new SessionStateHolder();
        SessionContext sessionContext = new MinaBackedSessionContext(serverRuntimeContext, stateHolder, ioSession);
        ioSession.setAttribute(ATTRIBUTE_VYSPER_SESSION, sessionContext);
        ioSession.setAttribute(ATTRIBUTE_VYSPER_SESSIONSTATEHOLDER, stateHolder);
    }
View Full Code Here

        ((DefaultServerRuntimeContext)sessionContext.getServerRuntimeContext()).setPresenceCache(getCache());
    }

    public void testGet() {
       
        SessionStateHolder sessionStateHolder = new SessionStateHolder();
        sessionStateHolder.setState(SessionState.AUTHENTICATED);

        // pres 1
        XMPPCoreStanza initialPresence1 = sendInitialPresence(sessionStateHolder, initiatingUser);
        PresenceStanza presenceStanza1 = getCache().get(initiatingUser.getEntityFQ());
        assertSame(initialPresence1, presenceStanza1);
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

    /**
     * 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

    @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

                .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();
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

        ((DefaultServerRuntimeContext) sessionContext.getServerRuntimeContext()).setPresenceCache(getCache());
    }

    public void testGet() {

        SessionStateHolder sessionStateHolder = new SessionStateHolder();
        sessionStateHolder.setState(SessionState.AUTHENTICATED);

        // pres 1
        XMPPCoreStanza initialPresence1 = sendInitialPresence(sessionStateHolder, initiatingUser);
        PresenceStanza presenceStanza1 = getCache().get(initiatingUser.getEntityFQ());
        assertSame(initialPresence1, presenceStanza1);
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.