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        ConnectionListener l = (ConnectionListener) listener;        if (type == OPENED) {            l.opened(this);        } else if (type == DISCONNECTED) {            l.disconnected(this);        } else if (type == CLOSED) {            l.closed(this);        } else {            throw new RuntimeException("Unknown type " + type);        }    }