@Test
	public void testMultiThreadedBehaviorIsFair() throws InterruptedException {
		simpleTestSetup();
		final AtomicInteger www1 = new AtomicInteger(0);
		final AtomicInteger www2 = new AtomicInteger(0);
		final AtomicInteger www3 = new AtomicInteger(0);

		int numThreads = 100;
		Thread[] threads = new Thread[numThreads];
		for (int i = 0; i < numThreads; i++) {
			threads[i] = new Thread() {
				public void run() {
					Random random = new Random();
					for (int i = 0; i < 100; i++) {
						URI item = LoadBalancer
								.getBestResource(LOAD_BALANCER_KEY);
						if (item.toASCIIString().contains("www1")) {
							www1.incrementAndGet();
						}
						if (item.toASCIIString().contains("www2")) {
							www2.incrementAndGet();
						}
						if (item.toASCIIString().contains("www3")) {
							www3.incrementAndGet();
						}
						try {
							// simulate the consumer doing something with
							// the URI
							Thread.sleep(50);
						} catch (InterruptedException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
						// Return the URI once done with it.
						LoadBalancer.returnResource(LOAD_BALANCER_KEY, item);
					}
				}
			};
		}
		for (int i = 0; i < numThreads; i++) {
			threads[i].start();
		}
		for (int i = 0; i < numThreads; i++) {
			threads[i].join();
		}
		int nwww1 = www1.get();
		int nwww2 = www2.get();
		int nwww3 = www3.get();

		// Sanity check.
		Assert.assertEquals(10000, nwww1 + nwww2 + nwww3);

		// Why am I doing this strange thing where I'm not checking
		// for all of the numbers being 3333/3334, but instead checking
		// that they are all greater than a number below that?
		// Load balancing will not show exactly even numbers, but should
		// be fair based on the workload that the consumer is doing with the
		// URI.
		// [Fairness determined mainly by how many active requests are on the
		// resource, see LoadBalancee's compareTo for more information]
		// The reason for appearing slightly
		// unfair is that if multiple threads are working with the
		// same URI, then that URI is then less likely to be given
		// to other threads. This randomness due to task scheduling, means that
		// straight equal numbers are not expected (nor desired)
		Assert.assertTrue(nwww1 / 3250 == 1);
		Assert.assertTrue(nwww3 / 3250 == 1);
		Assert.assertTrue(nwww2 / 3250 == 1);

	}