def test_badVersion(self):
        """
        Test that the transport disconnects when it receives a bad version.
        """
        def testBad(version):
            self.packets = []
            self.proto.gotVersion = False
            disconnected = [False]
            def stubLoseConnection():
                disconnected[0] = True
            self.transport.loseConnection = stubLoseConnection
            for c in iterbytes(version + b'\r\n'):
                self.proto.dataReceived(c)
            self.assertTrue(disconnected[0])
            self.assertEqual(self.packets[0][0], transport.MSG_DISCONNECT)
            self.assertEqual(
                self.packets[0][1][3:4],
                chr(transport.DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED))
        testBad(b'SSH-1.5-OpenSSH')
        testBad(b'SSH-3.0-Twisted')
        testBad(b'GET / HTTP/1.1')

        Test that the transport disconnects when it receives a bad version.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_transport.py