use of com.hazelcast.client.connection.ClientConnectionManager in project hazelcast by hazelcast.
the class ClientClusterServiceImpl method getLocalClient.
@Override
public Client getLocalClient() {
Address address = getOwnerConnectionAddress();
final ClientConnectionManager cm = client.getConnectionManager();
final ClientConnection connection = (ClientConnection) cm.getConnection(address);
InetSocketAddress inetSocketAddress = connection != null ? connection.getLocalSocketAddress() : null;
final String uuid = getPrincipal().getUuid();
return new ClientImpl(uuid, inetSocketAddress);
}
use of com.hazelcast.client.connection.ClientConnectionManager in project hazelcast by hazelcast.
the class ClientServiceTest method testPendingEventPacketsWithEvents.
@Test(timeout = 120000)
public void testPendingEventPacketsWithEvents() throws InterruptedException, UnknownHostException {
HazelcastInstance hazelcastInstance = hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
IMap map = client.getMap(randomName());
map.addEntryListener(new EntryAdapter(), false);
for (int i = 0; i < 10; i++) {
map.put(randomString(), randomString());
}
HazelcastClientInstanceImpl clientInstanceImpl = ClientTestUtil.getHazelcastClientInstanceImpl(client);
InetSocketAddress socketAddress = hazelcastInstance.getCluster().getLocalMember().getSocketAddress();
Address address = new Address(socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
ClientConnectionManager connectionManager = clientInstanceImpl.getConnectionManager();
final ClientConnection connection = (ClientConnection) connectionManager.getConnection(address);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(0, connection.getPendingPacketCount());
}
});
}
use of com.hazelcast.client.connection.ClientConnectionManager in project hazelcast by hazelcast.
the class ClientTestSupport method blockMessagesToInstance.
/**
* Blocks outgoing messages from client to given instance
*/
protected void blockMessagesToInstance(HazelcastInstance instance, HazelcastInstance client) {
HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
Address address = instance.getCluster().getLocalMember().getAddress();
((TestClientRegistry.MockClientConnectionManager) connectionManager).blockTo(address);
}
Aggregations