public PacketHandler(Protocol protocol, ProtocolConnection connection) {
        this.connection = connection;
        List<PacketInfos> infos = protocol.getPacketInfos();
        for (PacketInfos packetInfo : infos) {
            if (packetInfo.isReceivable()) {
                try {
                    String packetName = packetInfo.getType().getSimpleName();
                    Method m = this.getClass().getMethod("handle" + packetName, packetInfo.getType());
                    this.handlers.put(packetInfo.getId(), m);
                    this.listeners.put(packetInfo.getType(), new ArrayList<PacketListener>());
                } catch (NoSuchMethodException e) {
                    throw new RuntimeException("No handling for packet " + packetInfo.getType().getSimpleName() + " implemented!", e);
                }
            }
        }

        handler = new Thread(new Runnable() {
            public void run() {
                runHandler();
            }
        });
        handler.start();
    }