private static <T> Codec<T> getCodec(TypeToken<T> type) {
        Class<? super T> rawType = type.getRawType();
        do {
            Message message = rawType.getAnnotation(Message.class);
            if (message != null) {
                Class<? extends Codec<?>> codec = message.codec();
                try {
                    //noinspection unchecked
                    return (Codec<T>) codec.getDeclaredConstructor().newInstance();
                } catch (ReflectiveOperationException e) {
                    e.printStackTrace();
                }
            }
        } while ((rawType = rawType.getSuperclass()) != null);

        return new GsonCodec<>(type);
    }
Distributes an oncoming message to the channels held in this messenger.

@param channel the channel the message was received on
@param message the message
helper/src/main/java/me/lucko/helper/messaging/AbstractMessenger.java