Package org.menacheri.jetclient.event

Examples of org.menacheri.jetclient.event.Event


      }
    }

    MessageBuffer<ChannelBuffer> buffer = loginHelper
        .getLoginBuffer(udpAddress);
    Event loginEvent = Events.event(buffer, Events.LOG_IN);
    doTcpConnection(session, loginEvent);
  }
View Full Code Here


    if (null != udpClient)
    {
      udpAddress = doUdpConnection(session);
    }

    Event reconnectEvent = Events.event(
        loginHelper.getReconnectBuffer(reconnectKey, udpAddress),
        Events.RECONNECT);

    doTcpConnection(session, reconnectEvent);
  }
View Full Code Here

      throw new IllegalStateException("DatagramChannel: "
          + datagramChannel
          + " Passed to connect method is not bound");
    }

    Event event = Events.event(null, Events.CONNECT);
    ChannelFuture future = datagramChannel.write(event, serverAddress);
    future.addListener(new ChannelFutureListener()
    {
      @Override
      public void operationComplete(ChannelFuture future)
View Full Code Here

  @Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
      throws Exception
  {
    Event event = (Event) e.getMessage();
    session.onEvent(event);
  }
View Full Code Here

  public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
      throws Exception
  {
    System.err.println("Class:DefaultToClientHandler"
        + " Exception occurred in tcp channel: " + e.getCause());
    Event event = Events.event(e, Events.EXCEPTION);
    session.onEvent(event);
  }
View Full Code Here

    DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
    Session session = NettyUDPClient.CLIENTS.get(datagramChannel
        .getLocalAddress());
    if (null != session)
    {
      Event event = (Event) e.getMessage();
      // Pass the event on to the session
      session.onEvent(event);
    }
  }
View Full Code Here

    DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
    Session session = NettyUDPClient.CLIENTS.get(datagramChannel
        .getLocalAddress());
    if (null != session)
    {
      Event event = Events.event(e, Events.EXCEPTION);
      session.onEvent(event);
    }
  }
View Full Code Here

    DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
    Session session = NettyUDPClient.CLIENTS.get(datagramChannel
        .getLocalAddress());
    if ((null != session) && !session.isShuttingDown())
    {
      Event event = Events.event(e, Events.DISCONNECT);
      session.onEvent(event);
    }
    else if (null != session)
    {
      System.out.println("Session is already shutting down. "
View Full Code Here

    DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
    Session session = NettyUDPClient.CLIENTS.get(datagramChannel
        .getLocalAddress());
    if ((null != session) && !session.isShuttingDown())
    {
      Event event = Events.event(e, Events.DISCONNECT);
      session.onEvent(event);
    }
  }
View Full Code Here

  {
    if (null == msg)
    {
      return msg;
    }
    Event event = (Event) msg;
    ChannelBuffer opcode = ChannelBuffers.buffer(1);
    opcode.writeByte(event.getType());
    if (Events.LOG_IN == event.getType() || Events.RECONNECT == event.getType())
    {
      // write protocol version also
      ChannelBuffer protocolVersion = ChannelBuffers.buffer(1);
      protocolVersion.writeByte(Events.PROTOCOL_VERSION);
      opcode = ChannelBuffers.wrappedBuffer(opcode, protocolVersion);
    }
   
    ChannelBuffer buffer = null;
    if (null != event.getSource())
    {
      @SuppressWarnings("unchecked")
      MessageBuffer<ChannelBuffer> msgBuffer = (MessageBuffer<ChannelBuffer>) event
          .getSource();
      ChannelBuffer data = msgBuffer.getNativeBuffer();
      buffer = ChannelBuffers.wrappedBuffer(opcode, data);
    }
    else
View Full Code Here

TOP

Related Classes of org.menacheri.jetclient.event.Event

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.