Package ch.softappeal.yass.core.remote.session

Examples of ch.softappeal.yass.core.remote.session.Packet


    final int requestNumber = reader.readInt();
    return Packet.isEnd(requestNumber) ? Packet.END : new Packet(requestNumber, (Message)messageSerializer.read(reader));
  }

  @Override public void write(final Object value, final Writer writer) throws Exception {
    final Packet packet = (Packet)value;
    if (packet.isEnd()) {
      writer.writeInt(Packet.END_REQUEST_NUMBER);
    } else {
      writer.writeInt(packet.requestNumber());
      messageSerializer.write(packet.message(), writer);
    }
  }
View Full Code Here


    writerQueue.put(buffer);
  }

  private void read(final Session session, final Reader reader) {
    while (true) {
      final Packet packet;
      try {
        packet = (Packet)packetSerializer.read(reader);
      } catch (final Exception e) {
        close(session, e);
        return;
      }
      received(session, packet);
      if (packet.isEnd()) {
        return;
      }
    }
  }
View Full Code Here

    this.messageSerializer = Check.notNull(messageSerializer);
  }

  @Override public Packet read(final Reader reader) throws Exception {
    final int requestNumber = reader.readInt();
    return Packet.isEnd(requestNumber) ? Packet.END : new Packet(requestNumber, (Message)messageSerializer.read(reader));
  }
View Full Code Here

    final int requestNumber = reader.readInt();
    return Packet.isEnd(requestNumber) ? Packet.END : new Packet(requestNumber, (Message)messageSerializer.read(reader));
  }

  @Override public void write(final Object value, final Writer writer) throws Exception {
    final Packet packet = (Packet)value;
    if (packet.isEnd()) {
      writer.writeInt(Packet.END_REQUEST_NUMBER);
    } else {
      writer.writeInt(packet.requestNumber());
      messageSerializer.write(packet.message(), writer);
    }
  }
View Full Code Here

    writerQueue.put(buffer);
  }

  private void read(final SessionClient sessionClient, final Reader reader) {
    while (true) {
      final Packet packet;
      try {
        packet = (Packet)packetSerializer.read(reader);
      } catch (final Exception e) {
        sessionClient.close(e);
        return;
      }
      sessionClient.received(packet);
      if (packet.isEnd()) {
        return;
      }
    }
  }
View Full Code Here

    writerQueue.put(buffer);
  }

  private void read(final Session session, final Reader reader) {
    while (true) {
      final Packet packet;
      try {
        packet = (Packet)packetSerializer.read(reader);
      } catch (final Exception e) {
        close(session, e);
        return;
      }
      received(session, packet);
      if (packet.isEnd()) {
        return;
      }
    }
  }
View Full Code Here

TOP

Related Classes of ch.softappeal.yass.core.remote.session.Packet

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.