throw new RuntimeException("Unknown type " + type);
throw new IllegalArgumentException("Unknown type " + type);
    public void dispatch(Object listener) {        // assume that it is the right listener type        TransportListener l = (TransportListener) listener;        if (type == MESSAGE_DELIVERED) {            l.messageDelivered(this);        } else if (type == MESSAGE_NOT_DELIVERED) {            l.messageNotDelivered(this);        } else if (type == MESSAGE_PARTIALLY_DELIVERED) {            l.messagePartiallyDelivered(this);        } else {            throw new RuntimeException("Unknown type " + type);        }    }