@Test
    public void testDeregisterUserSpecificListener() throws Exception
    {
        // Setup fixture.
        final JID entity = new JID( "john", "example.org", "mobile" );
        final EntityCapabilities caps = new EntityCapabilities();
        caps.setVerAttribute( "test-ver" );
        caps.setHashAttribute( "test-hash" );
        manager.addListener( entity, userSpecific );
        manager.removeListener( entity, userSpecific );

        // Execute system under test.
        manager.registerCapabilities( entity, caps );

        // Verify results.
        verify( userSpecific, never() ).entityCapabilitiesChanged( entity, caps, Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), Collections.emptySet() );
    }
Asserts that removing the registration of an user-specific listener causes that listener to no longer receive events.
xmppserver/src/test/java/org/jivesoftware/openfire/entitycaps/EntityCapabilitiesListenerTest.java