@Test(timeout = 60000)
  public void testEvictionOfExpired() throws Exception {
    pooledFactory.setExpiryTimeout(10);
    Connection connection = pooledFactory.createConnection();
    Connection amq1 = ((PooledConnection) connection).getConnection();

    // let it expire while in use
    TimeUnit.MILLISECONDS.sleep(500);
    connection.close();

    Connection connection2 = pooledFactory.createConnection();
    Connection amq2 = ((PooledConnection) connection2).getConnection();
    assertTrue("not equal", !amq1.equals(amq2));
  }
  @Test(timeout = 60000)
  public void testEvictionOfIdle() throws Exception {
    pooledFactory.setIdleTimeout(10);
    PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
    Connection amq1 = connection.getConnection();

    connection.close();

    // let it idle timeout
    TimeUnit.MILLISECONDS.sleep(500);

    PooledConnection connection2 = (PooledConnection) pooledFactory.createConnection();
    Connection amq2 = connection2.getConnection();
    assertTrue("not equal", !amq1.equals(amq2));
  }