private void testRate(final int rate, final boolean spin) throws Exception
{
final double error = 0.05; // Allow for 5% error
TokenBucketLimiterImpl tbl = new TokenBucketLimiterImpl(rate, spin);
long start = System.currentTimeMillis();
long count = 0;
final long measureTime = 5000;
while (System.currentTimeMillis() - start < measureTime)
{
tbl.limit();
count++;
}
long end = System.currentTimeMillis();