Add round-trip test and fix pub/sub.