Extract async RPC code into one place.

- Because that's how it should be.
- Because it lets me use a single prerequisite in midje which hides the
  async bits, so that midje doesn't break.