Search in sources :

Example 6 with TransportClient

use of com.baidu.hugegraph.computer.core.network.TransportClient in project hugegraph-computer by hugegraph.

the class AbstractNetworkTest method oneClient.

protected TransportClient oneClient() throws IOException {
    ConnectionId connectionId = ConnectionId.parseConnectionId(host, port);
    TransportClient client = connectionManager.getOrCreateClient(connectionId);
    Assert.assertTrue(client.active());
    return client;
}
Also used : ConnectionId(com.baidu.hugegraph.computer.core.network.ConnectionId) TransportClient(com.baidu.hugegraph.computer.core.network.TransportClient)

Example 7 with TransportClient

use of com.baidu.hugegraph.computer.core.network.TransportClient in project hugegraph-computer by hugegraph.

the class ConnectionManagerTest method testCloseClient.

@Test
public void testCloseClient() throws IOException {
    ConnectionId connectionId = ConnectionId.parseConnectionId("127.0.0.1", port);
    TransportClient client = connectionManager.getOrCreateClient(connectionId);
    Assert.assertTrue(client.active());
    connectionManager.closeClient(client.connectionId());
    Assert.assertFalse(client.active());
}
Also used : ConnectionId(com.baidu.hugegraph.computer.core.network.ConnectionId) TransportClient(com.baidu.hugegraph.computer.core.network.TransportClient) Test(org.junit.Test)

Aggregations

TransportClient (com.baidu.hugegraph.computer.core.network.TransportClient)7 ConnectionId (com.baidu.hugegraph.computer.core.network.ConnectionId)5 Test (org.junit.Test)4 ClientFactory (com.baidu.hugegraph.computer.core.network.ClientFactory)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1