@Test 
public void testClose() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, SQLException, InterruptedException{

	this.testClass.doubleCloseCheck = true;
	Connection mockInternalConnection = EasyMock.createNiceMock(Connection.class);
	this.testClass.setInternalConnection(mockInternalConnection);
	this.testClass.renewConnection();
	this.mockPool.releaseConnection((Connection)anyObject());
	expectLastCall().once().andThrow(new SQLException()).once();
	expect(this.mockPool.getFinalizableRefs()).andReturn(new HashMap<Connection, Reference<ConnectionHandle>>()).anyTimes();
	expect(this.mockPool.getConfig()).andReturn(this.config).anyTimes();
	expect(mockInternalConnection.isClosed()).andReturn(false).anyTimes();
	replay(this.mockPool, mockInternalConnection);
	// create a thread so that we can check that thread.interrupt was called during connection close.
	//		final Thread thisThread = Thread.currentThread();
	Thread testThread = new Thread(new Runnable() {
		public void run() {
			try {
				TestConnectionHandle.this.started = true;
				while(true){
					Thread.sleep(20);
				}
			} catch (Exception e) {
				TestConnectionHandle.this.interrupted = true;
			}
		}
	});
	testThread.start();
	while (!this.started){
		Thread.sleep(20);
	}
	this.testClass.setThreadWatch(testThread);
	this.testClass.close();
	testThread.join();
	assertTrue(this.interrupted); // thread should have been interrupted 
	// logically mark the connection as closed
	Assert.assertTrue(this.testClass.logicallyClosed.get());
	assertTrue(this.testClass.isClosed());
	this.testClass.renewConnection();
	try{
		this.testClass.close(); // 2nd time should throw an exception
		fail("Should have thrown an exception");
	} catch (Throwable t){
		// do nothing.
	}
}