'If the server sends a literal length which cannot be parsed as an
integer, L{IMAP4Client.lineReceived} should cause the protocol to be
disconnected by raising L{imap4.IllegalServerResponse}.'

def test_nonIntegerLiteralLength(self):

    transport = StringTransport()
    protocol = imap4.IMAP4Client()
    protocol.makeConnection(transport)
    protocol.lineReceived('*    OK    [IMAP4rev1]')
    def login():
        d = protocol.login('blah', 'blah')
        protocol.dataReceived('0001    OK    LOGIN\r\n')
        return d
    def select():
        d = protocol.select('inbox')
        protocol.lineReceived('0002    OK    SELECT')
        return d
    def fetch():
        protocol.fetchSpecific('1:*', headerType='HEADER.FIELDS', headerArgs=['SUBJECT'])
        self.assertRaises(imap4.IllegalServerResponse, protocol.dataReceived, '*    1    FETCH    {xyz}\r\n...')
    d = login()
    d.addCallback(strip(select))
    d.addCallback(strip(fetch))
    return d
