Пример #1
0
 private void parsePacket(byte[] data, InetAddress address, int port) {
   String message = new String(data).trim();
   int packetId = Integer.parseInt(message.substring(0, 2));
   Packet packet = this.packets.get(packetId);
   packet.setData(data);
   packet.handleServer(this);
 }
Пример #2
0
 protected void addPacket(Packet packet) {
   this.packets.put((int) packet.getId(), packet);
 }