Examples of IOSession


Examples of org.apache.mina.common.IoSession

    }

    public void onPostRemove(IoFilterChain parent, String name,
            NextFilter nextFilter) throws Exception {
        super.onPostRemove(parent, name, nextFilter);
        IoSession session = parent.getSession();
        if (session == null) {
            return;
        }

        Zlib inflater = (Zlib) session.getAttribute(INFLATER);
        Zlib deflater = (Zlib) session.getAttribute(DEFLATER);
        if (deflater != null) {
            deflater.cleanUp();
        }

        if (inflater != null) {
View Full Code Here

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

Examples of org.apache.mina.common.IoSession

                    new ProtocolCodecFilter(
                            new ObjectSerializationCodecFactory()));
        }
        cfg.getFilterChain().addLast("logger", new LoggingFilter());

        IoSession session;
        for (;;) {
            try {
                ConnectFuture future = connector.connect(new InetSocketAddress(
                        HOSTNAME, PORT), new ClientSessionHandler(values), cfg);

                future.join();
                session = future.getSession();
                break;
            } catch (RuntimeIOException e) {
                System.err.println("Failed to connect.");
                e.printStackTrace();
                Thread.sleep(5000);
            }
        }

        // wait until the summation is done
        session.getCloseFuture().join();
    }
View Full Code Here

Examples of org.apache.mina.common.IoSession

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

Examples of org.apache.mina.common.IoSession

        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

Examples of org.apache.mina.common.IoSession

        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

Examples of org.apache.mina.common.IoSession

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

Examples of org.apache.mina.common.IoSession

                .hasNext();) {
            SocketAddress element = (SocketAddress) iter.next();

            for (Iterator iter2 = service.getManagedSessions(element)
                    .iterator(); iter2.hasNext();) {
                IoSession session = (IoSession) iter2.next();
                session.close();
            }
        }

    }
View Full Code Here

Examples of org.apache.mina.core.session.IoSession

        return;
      }
     
      for (ServerSharingViewerBean serverSharingViewerBean : viewersList) {
       
        IoSession session = ServerSocketMinaProcess.getSessionById(serverSharingViewerBean.getSessionId());
        session.write(cursorStatus);
       
      }
     
    } catch (Exception err) {
      log.error("[sendCursorPositionToSession]",err);
View Full Code Here

Examples of org.apache.mina.core.session.IoSession

        return;
      }
     
      for (ServerSharingViewerBean serverSharingViewerBean : viewersList) {
       
        IoSession session = ServerSocketMinaProcess.getSessionById(serverSharingViewerBean.getSessionId());
        session.write(serverStatusBean);
       
      }
     
    } catch (Exception err) {
      log.error("[sendStatusToSession]",err);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.