@Test
public void testFinalizer() throws SQLException, InterruptedException{

	ConnectionHandle mockConnectionHandle = createNiceMock(ConnectionHandle.class); 
	expect(mockConnectionHandle.isInReplayMode()).andReturn(true).anyTimes();
	Connection mockConnection = createNiceMock(Connection.class);
	Connection connection = MemorizeTransactionProxy.memorize(mockConnection, mockConnectionHandle);
	expect(mockConnectionHandle.getInternalConnection()).andReturn(connection).anyTimes();
	mockConnection.close();
	expectLastCall().once();
	reset(this.mockPool, this.mockConfig);
	Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
	expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
	FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();
	expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();
	expect(mockConnectionHandle.getPool()).andReturn(this.mockPool).anyTimes();
	expect(this.mockPool.getConfig()).andReturn(mockConfig).anyTimes();
	expect(mockConfig.getPoolName()).andReturn("foo").once();
	makeThreadSafe(this.mockPool, true);
	replay(mockConnection, mockConnectionHandle, this.mockPool, mockConfig);
		testClass.trackConnectionFinalizer(mockConnectionHandle);
		reset(mockConnectionHandle);
		mockConnectionHandle = null; // prompt GC to kick in
		for (int i=0; i < 500; i++){
			System.gc();System.gc();System.gc();
			Thread.sleep(20);
			try{
				verify(mockConnection);
				break; // we succeeded
			} catch (Throwable t){
				//				t.printStackTrace();
				// do nothing, try again
				Thread.sleep(20);
			}
		}
}