Clean-up and fix retry() a little.
Tests for retry().
Factor out some common test code and add two missing inlineCallbacks.