'The client is allowed to send a guessed key exchange packet
after it sends the KEXINIT packet.  However, if the key exchanges
do not match, that guess packet must be ignored.  This tests that
the packet is ignored in the case of the key exchange method not
matching.'

def test_ignoreGuessPacketKex(self):

    kexInitPacket = ((('\x00' * 16) + ''.join([common.NS(x) for x in [','.join(y) for y in [self.proto.supportedKeyExchanges[::(-1)], self.proto.supportedPublicKeys, self.proto.supportedCiphers, self.proto.supportedCiphers, self.proto.supportedMACs, self.proto.supportedMACs, self.proto.supportedCompressions, self.proto.supportedCompressions, self.proto.supportedLanguages, self.proto.supportedLanguages]]])) + '\xff\x00\x00\x00\x00')
    self.proto.ssh_KEXINIT(kexInitPacket)
    self.assertTrue(self.proto.ignoreNextPacket)
    self.proto.ssh_DEBUG('\x01\x00\x00\x00\x04test\x00\x00\x00\x00')
    self.assertTrue(self.proto.ignoreNextPacket)
    self.proto.ssh_KEX_DH_GEX_REQUEST_OLD('\x00\x00\x08\x00')
    self.assertFalse(self.proto.ignoreNextPacket)
    self.assertEqual(self.packets, [])
    self.proto.ignoreNextPacket = True
    self.proto.ssh_KEX_DH_GEX_REQUEST(('\x00\x00\x08\x00' * 3))
    self.assertFalse(self.proto.ignoreNextPacket)
    self.assertEqual(self.packets, [])
