@SuppressWarnings("unchecked")
    public <C extends Client> Optional<C> findClient(final Class<C> clazz) {
        CommonHelper.assertNotNull("clazz", clazz);
        init();
        if (clazz != null) {
            for (final Client client : getClients()) {
                if (clazz.isAssignableFrom(client.getClass())) {
                    return Optional.of((C) client);
                }
            }
        }
        LOGGER.debug("No client found for class: {}", clazz);
        return Optional.empty();
    }
@ SuppressWarnings ( "unchecked" ) public < C extends Client > Optional < C > findClient ( final Class < C > clazz ) { CommonHelper . assertNotNull ( "clazz" , clazz ) ; init ( ) ; if ( clazz != null ) { for ( final Client client : getClients ( ) ) { if ( clazz . isAssignableFrom ( client . getClass ( ) ) ) { return Optional . of ( ( C ) client ) ; } } } LOGGER . debug ( "No client found for class: {}" , clazz ) ; return Optional . empty ( ) ; }
Return the right client according to the specific class.

@param clazz class of the client
@param <C> the kind of client
@return the right client