protected void streamInvalid(String identifier) {
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_INVALID_SESSION,
           new byte[] {(byte) (identifier.length() & 0xff)},
           identifier.getBytes(StandardCharsets.UTF_8));
   this.server.pushThreadToMainPacket(buffer);
 }
 protected void streamOption(String name, String value) {
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_SET_OPTION,
           new byte[] {(byte) (name.length() & 0xff)},
           name.getBytes(StandardCharsets.UTF_8),
           value.getBytes(StandardCharsets.UTF_8));
   this.server.pushThreadToMainPacket(buffer);
 }
 protected void streamACK(String identifier, int identifierACK) {
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_ACK_NOTIFICATION,
           new byte[] {(byte) (identifier.length() & 0xff)},
           identifier.getBytes(StandardCharsets.UTF_8),
           Binary.writeInt(identifierACK));
   this.server.pushThreadToMainPacket(buffer);
 }
 protected void streamClose(String identifier, String reason) {
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_CLOSE_SESSION,
           new byte[] {(byte) (identifier.length() & 0xff)},
           identifier.getBytes(StandardCharsets.UTF_8),
           new byte[] {(byte) (reason.length() & 0xff)},
           reason.getBytes(StandardCharsets.UTF_8));
   this.server.pushThreadToMainPacket(buffer);
 }
 public void streamRAW(String address, int port, byte[] payload) {
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_RAW,
           new byte[] {(byte) (address.length() & 0xff)},
           address.getBytes(StandardCharsets.UTF_8),
           Binary.writeShort(port),
           payload);
   this.server.pushThreadToMainPacket(buffer);
 }
 public void streamEncapsulated(Session session, EncapsulatedPacket packet, int flags) {
   String id = session.getAddress() + ":" + session.getPort();
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_ENCAPSULATED,
           new byte[] {(byte) (id.length() & 0xff)},
           id.getBytes(StandardCharsets.UTF_8),
           new byte[] {(byte) (flags & 0xff)},
           packet.toBinary(true));
   this.server.pushThreadToMainPacket(buffer);
 }
 protected void streamOpen(Session session) {
   String identifier = session.getAddress() + ":" + session.getPort();
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_OPEN_SESSION,
           new byte[] {(byte) (identifier.length() & 0xff)},
           identifier.getBytes(StandardCharsets.UTF_8),
           new byte[] {(byte) (session.getAddress().length() & 0xff)},
           session.getAddress().getBytes(StandardCharsets.UTF_8),
           Binary.writeShort(session.getPort()),
           Binary.writeLong(session.getID()));
   this.server.pushThreadToMainPacket(buffer);
 }