Fix async testing not stopping execution.

I don't like how the test code in the lib has gotten to a messy
point, but it's the only way right now I can think of that will
make testing possible.