in mobius-core/src/main/java/com/spotify/mobius/QueuingConnection.java [45:57]
void setDelegate(Connection<I> active) {
if (delegate.get() == NOOP) {
return;
}
if (!delegate.compareAndSet(queuingDelegate, active)) {
throw new IllegalStateException("Attempt at setting the active delegate twice");
}
// now that we know we have an active connection to send messages to, drain the queue of any
// messages.
queuingDelegate.drainQueueIfActive();
}