Package org.apache.mina.core.session

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


        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

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

    ServerSharingViewersList.addNewViewerClient(sessionId,message);
   
    //Initial Screens loading
    ServerSharingSessionBean serverSharingSessionBean = ServerSharingSessionList.getServerSharingSessionBeanByPublicSID(message.getPublicSID());
   
    IoSession session = ServerSocketMinaProcess.getSessionById(sessionId);
   
    for (ServerFrameBean serverFrameBean : serverSharingSessionBean.getServerFrameBeans()) {
      session.write(serverFrameBean);
    }
   
  }
View Full Code Here

       
        if (handle == null) {
            throw new IllegalArgumentException("Unknown local address: " + localAddress);
        }

        IoSession session;
        IoSessionRecycler sessionRecycler = getSessionRecycler();
       
        synchronized (sessionRecycler) {
            session = sessionRecycler.recycle(localAddress, remoteAddress);
           
            if (session != null) {
                return session;
            }

            // If a new session needs to be created.
            T newSession = newSession(processor, handle, remoteAddress);
            getSessionRecycler().put(newSession);
            session = newSession;
        }

        initSession(session, null, null);

        try {
            this.getFilterChainBuilder().buildFilterChain(session.getFilterChain());
            getListeners().fireSessionCreated(session);
        } catch (Throwable t) {
            ExceptionMonitor.getInstance().exceptionCaught(t);
        }
View Full Code Here

                getSessionConfig().getReadBufferSize());

        SocketAddress remoteAddress = receive(handle, readBuf);
       
        if (remoteAddress != null) {
            IoSession session = newSessionWithoutLock(
                    remoteAddress, localAddress(handle));

            readBuf.flip();

            IoBuffer newBuf = IoBuffer.allocate(readBuf.limit());
            newBuf.put(readBuf);
            newBuf.flip();

            session.getFilterChain().fireMessageReceived(newBuf);
        }
    }
View Full Code Here

                AvailablePortFinder.getNextAvailable(20000));

        acceptor.bind(addr);
        ConnectFuture future = connector.connect(addr);
        future.awaitUninterruptibly();
        IoSession session = future.getSession();
        WriteFuture wf = session.write(IoBuffer.allocate(1))
                .awaitUninterruptibly();
        assertNotNull(wf.getException());

        connector.dispose();
        acceptor.dispose();
View Full Code Here

    // Start communication.
    ConnectFuture cf = connector.connect(new InetSocketAddress("localhost", 9123));
    cf.awaitUninterruptibly();

    IoSession session = cf.getSession();

    // send a message
    session.write("Hello World!\r");

    // wait until response is received
    CountDownLatch latch = (CountDownLatch) session.getAttribute("latch");
    latch.await();

    // close the session
    CloseFuture closeFuture = session.close(false);

    System.out.println("session.close called");
    //Thread.sleep(5);

    // wait for session close and then dispose the connector
View Full Code Here

  connectFuture.await(TIMEOUT);
  if (!connectFuture.isConnected()) {
      throw new IOException("Couldn't connect to GTALK server!");
  }

  final IoSession session = connectFuture.getSession();
  send(session, IoBuffer.wrap(new byte[] { 0x07 })); // connection sanity check
  System.out.println("Connected to server.");

  String deviceIDStr = String.valueOf(new BigInteger(service.getAndroidID(), 16).longValue());
  String securityTokenStr = String.valueOf(new BigInteger(service.getSecurityToken(), 16).longValue());
View Full Code Here

     * @param ldapSession the LdapSession instance
     */
    protected void insertSaslFilter( LdapSession ldapSession )
    {
        LOG.debug( "Inserting SaslFilter to engage negotiated security layer." );
        IoSession ioSession = ldapSession.getIoSession();

        // get the Io chain
        IoFilterChain chain = ioSession.getFilterChain();

        if ( !chain.contains( SaslConstants.SASL_FILTER ) )
        {
            SaslServer saslServer = ( SaslServer ) ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
            chain.addBefore( "codec", SaslConstants.SASL_FILTER, new SaslFilter( saslServer ) );
        }

        /*
         * We disable the SASL security layer once, to write the outbound SUCCESS
         * message without SASL security layer processing.
         */
        ioSession.setAttribute( SaslFilter.DISABLE_SECURITY_LAYER_ONCE, Boolean.TRUE );
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.core.session.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.