Greatly improve test coverage of the GCM sending code.

This pull request builds on the work done in #9 so that will need to be merged first.