'If :py:obj:`Context.set_tlsext_servername_callback` is used to specify a new
callback, the one it replaces is dereferenced.'

def test_old_callback_forgotten(self):

    def callback(connection):
        pass
    def replacement(connection):
        pass
    context = Context(TLSv1_METHOD)
    context.set_tlsext_servername_callback(callback)
    tracker = ref(callback)
    del callback
    context.set_tlsext_servername_callback(replacement)
    collect()
    collect()
    callback = tracker()
    if (callback is not None):
        referrers = get_referrers(callback)
        if (len(referrers) > 1):
            self.fail(('Some    references    remain:    %r' % (referrers,)))
