use of com.baidu.hugegraph.computer.core.network.ConnectionId in project hugegraph-computer by hugegraph.
the class ConnectionManagerTest method testShutDown.
@Test
public void testShutDown() throws IOException {
ConnectionId connectionId = ConnectionId.parseConnectionId("127.0.0.1", port);
TransportClient client = connectionManager.getOrCreateClient(connectionId);
Assert.assertTrue(client.active());
connectionManager.shutdownClients();
Assert.assertThrows(IllegalArgumentException.class, () -> {
connectionManager.getOrCreateClient(connectionId);
}, e -> {
Assert.assertContains("has not been initialized yet", e.getMessage());
});
connectionManager.shutdownServer();
Assert.assertThrows(IllegalArgumentException.class, () -> {
connectionManager.getServer();
}, e -> {
Assert.assertContains("has not been initialized yet", e.getMessage());
});
connectionManager.shutdown();
}
use of com.baidu.hugegraph.computer.core.network.ConnectionId in project hugegraph-computer by hugegraph.
the class ConnectionManagerTest method testGetOrCreateClient.
@Test
public void testGetOrCreateClient() throws IOException {
ConnectionId connectionId = ConnectionId.parseConnectionId("127.0.0.1", port);
TransportClient client = connectionManager.getOrCreateClient(connectionId);
Assert.assertTrue(client.active());
}
use of com.baidu.hugegraph.computer.core.network.ConnectionId 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;
}
use of com.baidu.hugegraph.computer.core.network.ConnectionId in project hugegraph-computer by hugegraph.
the class NettyClientFactoryTest method testClose.
@Test
public void testClose() throws IOException {
TransportConf conf = TransportConf.wrapConfig(config);
NettyClientFactory clientFactory = new NettyClientFactory(conf);
clientFactory.init();
ConnectionId connectionId = ConnectionId.parseConnectionId("127.0.0.1", 8086);
this.client = clientFactory.createClient(connectionId, clientHandler);
Assert.assertTrue(this.client.active());
this.client.close();
Assert.assertFalse(this.client.active());
}
use of com.baidu.hugegraph.computer.core.network.ConnectionId in project hugegraph-computer by hugegraph.
the class NettyClientFactoryTest method testCreateClient.
@Test
public void testCreateClient() throws IOException {
TransportConf conf = TransportConf.wrapConfig(config);
NettyClientFactory clientFactory = new NettyClientFactory(conf);
clientFactory.init();
ConnectionId connectionId = ConnectionId.parseConnectionId("127.0.0.1", 8086);
this.client = clientFactory.createClient(connectionId, clientHandler);
Assert.assertTrue(this.client.active());
}
Aggregations