Implement handle_recv, required in debug mode

Fixes #572