'Implementation of C{_test} which checks that the command sends C{send}
data, and that upon reception of C{recv} the result is C{result}.
@param d: the resulting deferred from the memcache command.
@type d: C{Deferred}
@param send: the expected data to be sent.
@type send: C{bytes}
@param recv: the data to simulate as reception.
@type recv: C{bytes}
@param result: the expected result.
@type result: C{any}'

def _test(self, d, send, recv, result):

    def cb(res):
        self.assertEqual(res, result)
    self.assertEqual(self.transport.value(), send)
    d.addCallback(cb)
    self.proto.dataReceived(recv)
    return d
