IMO these things are easier to do in socket-level tests. Any particular reason why not do it that way?