use of com.hazelcast.client.impl.connection.tcp.TcpClientConnectionManager in project hazelcast by hazelcast.
the class BackupListenerLeakTest method testBackupListenerIsNotRemoved_afterClientRestart.
@Test
public void testBackupListenerIsNotRemoved_afterClientRestart() throws InterruptedException {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(Long.MAX_VALUE);
HazelcastInstance hazelcast = hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
TcpClientConnectionManager connectionManager = (TcpClientConnectionManager) clientImpl.getConnectionManager();
connectionManager.reset();
Map<UUID, Consumer<Long>> backupListeners = ((ClientEngineImpl) getNode(hazelcast).clientEngine).getBackupListeners();
assertTrueEventually(() -> assertEquals(1, backupListeners.size()));
}
use of com.hazelcast.client.impl.connection.tcp.TcpClientConnectionManager in project hazelcast by hazelcast.
the class ClientRegressionWithRealNetworkTest method testNioChannelLeakTest.
@Test
public void testNioChannelLeakTest() {
ClientConfig config = new ClientConfig();
config.getConnectionStrategyConfig().setAsyncStart(true).setReconnectMode(ClientConnectionStrategyConfig.ReconnectMode.ASYNC).getConnectionRetryConfig().setInitialBackoffMillis(1).setClusterConnectTimeoutMillis(1000);
HazelcastInstance client = HazelcastClient.newHazelcastClient(config);
HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
TcpClientConnectionManager connectionManager = (TcpClientConnectionManager) clientInstanceImpl.getConnectionManager();
sleepSeconds(2);
assertTrueEventually(() -> assertEquals(0, connectionManager.getNetworking().getChannels().size()));
client.shutdown();
}
Aggregations