@SuppressWarnings("deprecation")
    private static List<Listener> createListenerAdapters(Object provider) {

        final List<Listener> listeners = new ArrayList<Listener>();

        if (provider instanceof AuthenticationSuccessListener) {
            listeners.add(new AuthenticationSuccessListenerAdapter(
                    (AuthenticationSuccessListener) provider));
        }

        if (provider instanceof AuthenticationFailureListener) {
            listeners.add(new AuthenticationFailureListenerAdapter(
                    (AuthenticationFailureListener) provider));
        }

        if (provider instanceof TunnelConnectListener) {
            listeners.add(new TunnelConnectListenerAdapter(
                    (TunnelConnectListener) provider));
        }

        if (provider instanceof TunnelCloseListener) {
            listeners.add(new TunnelCloseListenerAdapter(
                    (TunnelCloseListener) provider));
        }

        return listeners;

    }
Creates a list of adapters for the given object, based on the legacy
listener interfaces it implements.

@param provider
     An object that implements zero or more legacy listener interfaces.

@return
     The list of listeners represented by the given provider class.
guacamole/src/main/java/org/apache/guacamole/extension/ListenerFactory.java