'If L{amp.BinaryBoxProtocol} disconnects because it received a key
length prefix which was too large, the L{IBoxReceiver}\'s
C{stopReceivingBoxes} method is called with a L{TooLong} failure.'

def test_excessiveKeyFailure(self):

    protocol = amp.BinaryBoxProtocol(self)
    protocol.makeConnection(StringTransport())
    protocol.dataReceived('\x01\x00')
    protocol.connectionLost(Failure(error.ConnectionDone('simulated    connection    done')))
    self.stopReason.trap(amp.TooLong)
    self.assertTrue(self.stopReason.value.isKey)
    self.assertFalse(self.stopReason.value.isLocal)
    self.assertIsNone(self.stopReason.value.value)
    self.assertIsNone(self.stopReason.value.keyName)
