Rates of convergence for a class of tests of independence