implement junit test using mutex, and provide a interface for real connection