mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
21.27.2013 632803028dfe8bf67c23ece38f647c78c103cf9f
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java
@@ -27,8 +27,11 @@
package org.forgerock.opendj.ldap;
import static java.util.Arrays.asList;
import static org.fest.assertions.Assertions.assertThat;
import static org.forgerock.opendj.ldap.Connections.newFixedConnectionPool;
import static org.forgerock.opendj.ldap.Connections.newHeartBeatConnectionFactory;
import static org.forgerock.opendj.ldap.Connections.newLoadBalancer;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.TestCaseUtils.findFreeSocketAddress;
import static org.forgerock.opendj.ldap.TestCaseUtils.getServerSocketAddress;
@@ -651,15 +654,18 @@
        }
    }
    @Test(description = "Test for OPENDJ-1121", enabled = false)
    @Test(description = "Test for OPENDJ-1121: Closing a connection after "
            + "closing the connection factory causes NPE")
    public void testFactoryCloseBeforeConnectionClose() throws Exception {
        final ConnectionFactory factory =
                newFixedConnectionPool(new LDAPConnectionFactory(getServerSocketAddress()), 2);
                newLoadBalancer(new FailoverLoadBalancingAlgorithm(asList(newFixedConnectionPool(
                        newHeartBeatConnectionFactory(new LDAPConnectionFactory(
                                getServerSocketAddress())), 2))));
        Connection conn = null;
        try {
            conn = factory.getConnection();
            factory.close();
        } finally {
            factory.close();
            if (conn != null) {
                conn.close();
            }