Fix typo, update for new interface.
Update to allow a plugin to decide when to exit.
Add tests for stopping input and output.