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); }