'Data already parsed by L{IntNStringReceiver.dataReceived} is not
reparsed if C{stringReceived} consumes some of the
L{IntNStringReceiver.recvd} buffer.'

def test_switching(self):

    proto = self.getProtocol()
    mix = []
    SWITCH = '\x00\x00\x00\x00'
    for s in self.strings:
        mix.append(self.makeMessage(proto, s))
        mix.append(SWITCH)
    result = []
    def stringReceived(receivedString):
        result.append(receivedString)
        proto.recvd = proto.recvd[len(SWITCH):]
    proto.stringReceived = stringReceived
    proto.dataReceived(''.join(mix))
    proto.dataReceived('\x01')
    self.assertEqual(result, self.strings)
    self.assertEqual(proto.recvd, '\x01')
