Are you just asking how to start threads? You can make a class that extends Runnable and put some test code in the run() method. Then this will run two copies on two new threads about as close to simultaneously as you can get:
It's notoriously difficult to make threads get into nasty contention in a test ... it usually only happens during demonstrations to your customer.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi