use of com.hazelcast.client.impl.ClientEndpoint in project hazelcast by hazelcast.
the class ClientSelectorRaceTest method testConcurrency.
@Test
public void testConcurrency() throws InterruptedException {
HazelcastInstance instance = hazelcastFactory.newHazelcastInstance();
final ClientEngineImpl clientEngineImpl = getClientEngineImpl(instance);
LinkedList<Thread> threads = new LinkedList<Thread>();
int numberOfClients = 100;
for (int i = 0; i < numberOfClients; i++) {
Thread thread = new Thread(hazelcastFactory::newHazelcastClient);
thread.start();
threads.add(thread);
}
clientEngineImpl.applySelector(ClientSelectors.none());
for (Thread thread : threads) {
thread.join();
}
assertTrueEventually(() -> {
Collection<ClientEndpoint> endpoints = clientEngineImpl.getEndpointManager().getEndpoints();
assertEquals(0, endpoints.size());
});
}
use of com.hazelcast.client.impl.ClientEndpoint in project hazelcast by hazelcast.
the class ClientMessageDecoder method isEndpointTrusted.
private boolean isEndpointTrusted() {
if (clientEndpointManager == null || clientIsTrusted) {
return true;
}
ClientEndpoint endpoint = clientEndpointManager.getEndpoint(connection);
clientIsTrusted = endpoint != null && endpoint.isAuthenticated();
return clientIsTrusted;
}
use of com.hazelcast.client.impl.ClientEndpoint in project hazelcast by hazelcast.
the class ClientSelectorManagementCenterClientTest method testManagementCenterClient_doesNotGetDisconnected.
@Test
public void testManagementCenterClient_doesNotGetDisconnected() {
HazelcastInstance instance = hazelcastFactory.newHazelcastInstance();
final ClientEngineImpl clientEngineImpl = getClientEngineImpl(instance);
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty(MC_CLIENT_MODE_PROP.getName(), "true");
hazelcastFactory.newHazelcastClient(clientConfig);
clientEngineImpl.applySelector(ClientSelectors.none());
assertTrueAllTheTime(() -> {
Collection<ClientEndpoint> endpoints = clientEngineImpl.getEndpointManager().getEndpoints();
assertEquals(1, endpoints.size());
}, 10);
}
Aggregations