Avoid double call to write/send in test