### Question:
BasicHttpClientConnectionManager implements HttpClientConnectionManager { @Override public synchronized void release(final ConnectionEndpoint endpoint, final Object state, final TimeValue keepAlive) { Args.notNull(endpoint, "Managed endpoint"); final InternalConnectionEndpoint internalEndpoint = cast(endpoint); final ManagedHttpClientConnection conn = internalEndpoint.detach(); if (conn != null && LOG.isDebugEnabled()) { LOG.debug("Releasing connection {}", conn); } if (this.closed.get()) { return; } try { if (keepAlive == null) { this.conn.close(CloseMode.GRACEFUL); } this.updated = System.currentTimeMillis(); if (!this.conn.isOpen() && !this.conn.isConsistent()) { this.conn = null; this.route = null; this.conn = null; this.expiry = Long.MAX_VALUE; if (LOG.isDebugEnabled()) { LOG.debug("Connection is not kept alive"); } } else { this.state = state; conn.passivate(); if (TimeValue.isPositive(keepAlive)) { if (LOG.isDebugEnabled()) { LOG.debug("Connection can be kept alive for {}", keepAlive); } this.expiry = this.updated + keepAlive.toMilliseconds(); } else { if (LOG.isDebugEnabled()) { LOG.debug("Connection can be kept alive indefinitely"); } this.expiry = Long.MAX_VALUE; } } } finally { this.leased = false; } } BasicHttpClientConnectionManager(
            final Lookup<ConnectionSocketFactory> socketFactoryRegistry,
            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
            final SchemePortResolver schemePortResolver,
            final DnsResolver dnsResolver);  BasicHttpClientConnectionManager(
            final HttpClientConnectionOperator httpClientConnectionOperator,
            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory);  BasicHttpClientConnectionManager(
            final Lookup<ConnectionSocketFactory> socketFactoryRegistry,
            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory);  BasicHttpClientConnectionManager(
            final Lookup<ConnectionSocketFactory> socketFactoryRegistry);  BasicHttpClientConnectionManager(); @Override void close(); @Override void close(final CloseMode closeMode); synchronized SocketConfig getSocketConfig(); synchronized void setSocketConfig(final SocketConfig socketConfig); LeaseRequest lease(final String id, final HttpRoute route, final Object state); @Override LeaseRequest lease(final String id, final HttpRoute route, final Timeout requestTimeout, final Object state); @Override synchronized void release(final ConnectionEndpoint endpoint, final Object state, final TimeValue keepAlive); @Override void connect(final ConnectionEndpoint endpoint, final TimeValue connectTimeout, final HttpContext context); @Override void upgrade(
            final ConnectionEndpoint endpoint,
            final HttpContext context); synchronized void closeExpired(); synchronized void closeIdle(final TimeValue idleTime);  }### Answer:
@Test(expected=NullPointerException.class) public void testReleaseInvalidArg() throws Exception { mgr.release(null, null, TimeValue.NEG_ONE_MILLISECOND); }
@Test(expected=IllegalStateException.class) public void testReleaseAnotherConnection() throws Exception { final ConnectionEndpoint wrongCon = Mockito.mock(ConnectionEndpoint.class); mgr.release(wrongCon, null, TimeValue.NEG_ONE_MILLISECOND); }