Package org.apache.mina.core.session

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


        exchange.getIn().setBody("Hello World");
        producer.process(exchange);

        Field field = producer.getClass().getDeclaredField("session");
        field.setAccessible(true);
        IoSession session = (IoSession) field.get(producer);
        assertFalse("There should NOT default be a logger filter", session.getFilterChain().contains("logger"));

        assertMockEndpointsSatisfied();
        producer.stop();
    }
View Full Code Here


        exchange.getIn().setBody("Hello World");
        producer.process(exchange);

        Field field = producer.getClass().getDeclaredField("session");
        field.setAccessible(true);
        IoSession session = (IoSession) field.get(producer);
        assertTrue("There should be a logger filter", session.getFilterChain().contains("logger"));

        assertMockEndpointsSatisfied();
        producer.stop();
    }
View Full Code Here

        assertMockEndpointsSatisfied();

        Field field = producer.getClass().getDeclaredField("session");
        field.setAccessible(true);
        IoSession session = (IoSession) field.get(producer);
        assertTrue("There should be a test filter", session.getFilterChain().contains(TestFilter.class.getCanonicalName()));

        assertEquals("The filter should have been called twice (producer and consumer)", 2, TestFilter.called);

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

    {
        LdapDecoder ldapDecoder = new LdapDecoder();
        LdapMessageContainer<MessageDecorator<? extends Message>> container =
            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        IoSession dummySession = new DummySession();
        dummySession.setAttribute( "messageContainer", container );

        ByteBuffer stream = ByteBuffer.allocate( 0x6A );
        stream.put( new byte[]
            {
                0x30, 0x33,                     // LDAPMessage ::=SEQUENCE {
View Full Code Here

  }

  @Override
  public void run() {
    Object [] tmp = null;
    IoSession s = null;
    String username = null;
    String password = null;
    char language;
    while(true) {
      synchronized(m_queue) {
View Full Code Here

  /**
   * Called by m_thread.start()
   */
  public void run() {
    IoSession session;
    while(m_isRunning) {
      synchronized(m_queue) {
        if(m_queue.peek() != null) {
          session = m_queue.poll();
          try {
            this.register(session);
          } catch (Exception e) {
            e.printStackTrace();
            session.resumeRead();
            session.resumeWrite();
            session.write("r3");
          }
        }
      }
      try {
        Thread.sleep(250);
View Full Code Here

  /**
   * Called by Thread.start()
   */
  public void run() {
    Object [] o;
    IoSession session;
    String username;
    String password;
    String newPassword;
    char l;
    while(m_isRunning) {
View Full Code Here

         * Called by m_thread.start()
         */
        public void run() {
                Object [] o;
                ServerMap m;
                IoSession s;
                while(true) {
                        //Send next local chat message
                        if(m_localQueue.peek() != null) {
                                o = m_localQueue.poll();
                                m = GameServer.getServiceManager().getMovementService().
                                        getMapMatrix().getMapByGamePosition(Integer.parseInt((String) o[1]), Integer.parseInt((String) o[2]));
                                if(m != null)
                                        m.sendChatMessage((String) o[0], Language.valueOf(((String)o[3])));
                        }
                        //Send next private chat message
                        if(m_privateQueue.peek() != null) {
                                o = m_privateQueue.poll();
                                s = (IoSession) o[0];
                                if(s.isConnected() && !s.isClosing())
                                        TcpProtocolHandler.writeMessage(s, new ChatMessage(
                                                        ChatMessageType.PRIVATE, ((String) o[1]) + "," + ((String) o[2])));
                        }
                        try {
                                Thread.sleep(250);
View Full Code Here

        LdapDecoder ldapDecoder = new LdapDecoder();
        LdapMessageContainer<MessageDecorator<? extends Message>> container =
            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
        ldapDecoder.setLdapMessageContainer( container );

        IoSession dummySession = new DummySession();
        dummySession.setAttribute( "messageContainer", container );

        IoBuffer stream = IoBuffer.allocate( 0x6A );
        stream.put( new byte[]
            {
                0x30, 0x33,                     // LDAPMessage ::=SEQUENCE {
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.