'Receiving a KEXINIT packet listing multiple supported algorithms will
set up the first common algorithm found in the client\'s preference
list.'

def test_KEXINITMultipleAlgorithms(self):

    self.proto.dataReceived('SSH-2.0-Twisted\r\n\x00\x00\x01\xf4\x04\x14\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x00\x00\x00bdiffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256\x00\x00\x00\x0fssh-dss,ssh-rsa\x00\x00\x00\x85aes128-ctr,aes128-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc,cast128-ctr,cast128-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc\x00\x00\x00\x85aes128-ctr,aes128-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc,cast128-ctr,cast128-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc\x00\x00\x00\x12hmac-md5,hmac-sha1\x00\x00\x00\x12hmac-md5,hmac-sha1\x00\x00\x00 DCTB none,zlib\x00\x00\x00 DCTB none,zlib\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\x99\x99\x99')
    self.assertEqual(self.proto.kexAlg, 'diffie-hellman-group-exchange-sha1')
    self.assertEqual(self.proto.keyAlg, 'ssh-dss')
    self.assertEqual(self.proto.outgoingCompressionType, 'none')
    self.assertEqual(self.proto.incomingCompressionType, 'none')
    ne = self.proto.nextEncryptions
    self.assertEqual(ne.outCipType, 'aes128-ctr')
    self.assertEqual(ne.inCipType, 'aes128-ctr')
    self.assertEqual(ne.outMACType, 'hmac-md5')
    self.assertEqual(ne.inMACType, 'hmac-md5')
