'If the verify callback passed to :py:obj:`Context.set_verify` raises an
exception, verification fails and the exception is propagated to the
caller of :py:obj:`Connection.do_handshake`.'

def test_set_verify_callback_exception(self):

    serverContext = Context(TLSv1_METHOD)
    serverContext.use_privatekey(load_privatekey(FILETYPE_PEM, cleartextPrivateKeyPEM))
    serverContext.use_certificate(load_certificate(FILETYPE_PEM, cleartextCertificatePEM))
    clientContext = Context(TLSv1_METHOD)
    def verify_callback(*args):
        raise Exception('silly    verify    failure')
    clientContext.set_verify(VERIFY_PEER, verify_callback)
    exc = self.assertRaises(Exception, self._handshake_test, serverContext, clientContext)
    self.assertEqual('silly    verify    failure', str(exc))
