Problem: was not re-registering clients correctly

Stream re-registration code was incorrect, so second client using
the same pattern would not get any messages.

Solution: fix this.

Problem #2: at shutdown, did not properly flush in-flight messages.

Solution: do shutdown handshaking unless process was interrupted.