Examples of IOSession


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

        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

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

    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

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

       
        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

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

                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

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

                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

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

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

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

  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

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

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

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

            // Create the new principal
            principal = new LdapPrincipal( getDirectoryService().getSchemaManager(), bindContext.getDn(),
                AuthenticationLevel.SIMPLE,
                bindContext.getCredentials() );

            IoSession session = bindContext.getIoSession();

            if ( session != null )
            {
                SocketAddress clientAddress = session.getRemoteAddress();
                principal.setClientAddress( clientAddress );
                SocketAddress serverAddress = session.getServiceAddress();
                principal.setServerAddress( serverAddress );
            }

            return principal;
View Full Code Here

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

        // ---- extract password from JNDI environment
        byte[] credentials = bindContext.getCredentials();

        LdapPrincipal principal = getStoredPassword( bindContext );

        IoSession session = bindContext.getIoSession();

        if ( session != null )
        {
            SocketAddress clientAddress = session.getRemoteAddress();
            principal.setClientAddress( clientAddress );
            SocketAddress serverAddress = session.getServiceAddress();
            principal.setServerAddress( serverAddress );
        }

        // Get the stored password, either from cache or from backend
        byte[][] storedPasswords = principal.getUserPasswords();
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.