scassandra.node(1).currentClient().closeConnection(CLOSE, controlSocket);
currentClient.closeConnection(CLOSE, ((InetSocketAddress) core0.channel.localAddress())); currentClient.closeConnection(CLOSE, ((InetSocketAddress) core2.channel.localAddress())); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
/** * Ensures that if a connection on a host is lost but other connections remain intact in the Pool * that the host is not marked down. * * @jira_ticket JAVA-544 * @test_category connection:connection_pool * @since 2.0.11 */ @Test(groups = "short") public void should_keep_host_up_when_one_connection_lost() throws Exception { Cluster cluster = createClusterBuilder().build(); try { HostConnectionPool pool = createPool(cluster, 2, 2); Connection core0 = pool.connections.get(0); Connection core1 = pool.connections.get(1); // Drop a connection and ensure the host stays up. currentClient.disableListener(); currentClient.closeConnection(CLOSE, ((InetSocketAddress) core0.channel.localAddress())); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); // connection 0 should be down, while connection 1 and the Host should remain up. assertThat(core0.isClosed()).isTrue(); assertThat(core1.isClosed()).isFalse(); assertThat(pool.connections).doesNotContain(core0); assertThat(cluster).host(1).hasState(Host.State.UP); assertThat(cluster).hasOpenControlConnection(); } finally { cluster.close(); } }
currentClient.closeConnection(CLOSE, ((InetSocketAddress) core0.channel.localAddress())); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); currentClient.disableListener();
scassandra.node(1).currentClient().closeConnection(CLOSE, controlSocket);
/** * Ensures that if a connection on a host is lost but other connections remain intact in the Pool * that the host is not marked down. * * @jira_ticket JAVA-544 * @test_category connection:connection_pool * @since 2.0.11 */ @Test(groups = "short") public void should_keep_host_up_when_one_connection_lost() throws Exception { Cluster cluster = createClusterBuilder().build(); try { HostConnectionPool pool = createPool(cluster, 2, 2); Connection core0 = pool.connections.get(0); Connection core1 = pool.connections.get(1); // Drop a connection and ensure the host stays up. currentClient.disableListener(); currentClient.closeConnection(CLOSE, ((InetSocketAddress) core0.channel.localAddress())); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); // connection 0 should be down, while connection 1 and the Host should remain up. assertThat(core0.isClosed()).isTrue(); assertThat(core1.isClosed()).isFalse(); assertThat(pool.connections).doesNotContain(core0); assertThat(cluster).host(1).hasState(Host.State.UP); assertThat(cluster).hasOpenControlConnection(); } finally { cluster.close(); } }
currentClient.closeConnection(CLOSE, ((InetSocketAddress) core0.channel.localAddress())); currentClient.closeConnection(CLOSE, ((InetSocketAddress) core2.channel.localAddress())); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
currentClient.closeConnection(CLOSE, ((InetSocketAddress) core0.channel.localAddress())); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); currentClient.disableListener();