Package org.apache.mina.common

Examples of org.apache.mina.common.IoSession


            throw new IllegalArgumentException("Unknown localAddress: "
                    + localAddress);
        }

        RegistrationRequest req = (RegistrationRequest) key.attachment();
        IoSession session;
        IoSessionRecycler sessionRecycler = getSessionRecycler(req);
        synchronized (sessionRecycler) {
            session = sessionRecycler.recycle(localAddress, remoteAddress);
            if (session != null) {
                return session;
View Full Code Here


            fireEvent(e);
        }
    }

    private void fireEvent(Event e) {
        IoSession session = getSession();
        EventType type = e.getType();
        Object data = e.getData();

        if (type == EventType.RECEIVED) {
            VmPipeSessionImpl s = (VmPipeSessionImpl) session;
View Full Code Here

        if (parent.contains(SSLFilter.class)) {
            throw new IllegalStateException(
                    "A filter chain cannot contain more than one SSLFilter.");
        }

        IoSession session = parent.getSession();
        session.setAttribute(NEXT_FILTER, nextFilter);

        // Create an SSL handler and start handshake.
        SSLHandler handler = new SSLHandler(this, sslContext, session);
        session.setAttribute(SSL_HANDLER, handler);
    }
View Full Code Here

        handler.flushScheduledEvents();
    }

    public void onPreRemove(IoFilterChain parent, String name,
            NextFilter nextFilter) throws SSLException {
        IoSession session = parent.getSession();
        stopSSL(session);
        session.removeAttribute(NEXT_FILTER);
        session.removeAttribute(SSL_HANDLER);
    }
View Full Code Here

        // handle app. data read (if any)
        handleAppDataRead(nextFilter, handler);
    }

    private void handleAppDataRead(NextFilter nextFilter, SSLHandler handler) {
        IoSession session = handler.getSession();
        handler.getAppBuffer().flip();
        if (!handler.getAppBuffer().hasRemaining()) {
            handler.getAppBuffer().clear();
            return;
        }
View Full Code Here

        // Connect to the server.
        VmPipeConnector connector = new VmPipeConnector();
        ConnectFuture future = connector.connect( address,
                                                  new TennisPlayer() );
        future.join();
        IoSession session = future.getSession();

        // Send the first ping message
        session.write( new TennisBall( 10 ) );

        // Wait until the match ends.
        session.getCloseFuture().join();
       
        acceptor.unbind( address );
    }
View Full Code Here

        if( parent.contains( SSLFilter.class ) )
        {
            throw new IllegalStateException( "A filter chain cannot contain more than one SSLFilter." );
        }

        IoSession session = parent.getSession();
        session.setAttribute( NEXT_FILTER, nextFilter );
       
        // Create an SSL handler and start handshake.
        SSLHandler handler =
            new SSLHandler( this, sslContext, session );
        session.setAttribute( SSL_HANDLER, handler );
    }
View Full Code Here

        getSSLSessionHandler( parent.getSession() ).handshake( nextFilter );
    }
   
    public void onPreRemove( IoFilterChain parent, String name, NextFilter nextFilter ) throws SSLException
    {
        IoSession session = parent.getSession();
        stopSSL( session );
        session.removeAttribute( NEXT_FILTER );
        session.removeAttribute( SSL_HANDLER );
    }
View Full Code Here

        handleAppDataRead( nextFilter, handler );
    }

    private void handleAppDataRead( NextFilter nextFilter, SSLHandler handler )
    {
        IoSession session = handler.getSession();
        if( !handler.getAppBuffer().hasRemaining() )
        {
            return;
        }
View Full Code Here

        }

        Zlib deflater = new Zlib( compressionLevel, Zlib.MODE_DEFLATER );
        Zlib inflater = new Zlib( compressionLevel, Zlib.MODE_INFLATER );

        IoSession session = parent.getSession();

        session.setAttribute( DEFLATER, deflater );
        session.setAttribute( INFLATER, inflater );
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.common.IoSession

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.