Got async tests working by running them in a thread

Should fix #383.