@Test
public void testUpdateCreatedConnectionsWithException() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {


	// Test #2: Same test but fake an exception 
	ReentrantReadWriteLock mockLock = createNiceMock(ReentrantReadWriteLock.class);
	WriteLock mockWriteLock = createNiceMock(WriteLock.class);
	Field field = testClass.getClass().getDeclaredField("statsLock");
	field.setAccessible(true);
	ReentrantReadWriteLock oldLock = (ReentrantReadWriteLock) field.get(testClass);
	field.set(testClass, mockLock);
	expect(mockLock.writeLock()).andThrow(new RuntimeException()).once().andReturn(mockWriteLock).once();
	mockWriteLock.lock();
	expectLastCall().once();
	replay(mockLock, mockWriteLock);
	try{
		testClass.updateCreatedConnections(5);
		fail("Should have thrown an exception");
	} catch (Throwable t){
		//do nothing
	}
	verify(mockLock);
	field.set(testClass, oldLock);
}