[PATCH 32/42] test: Move the receive code into a function