use a channel to wait for disconnect handler to be called