use of com.baidu.hugegraph.computer.core.network.TransportServer in project hugegraph-computer by hugegraph.
the class AbstractNetworkTest method mockSpyProtocol.
private void mockSpyProtocol() {
Object clientFactory = Whitebox.getInternalState(connectionManager, "clientFactory");
NettyProtocol protocol2 = Whitebox.getInternalState(clientFactory, "protocol");
clientProtocol = Mockito.spy(protocol2);
Whitebox.setInternalState(clientFactory, "protocol", clientProtocol);
TransportServer sever = connectionManager.getServer();
ServerBootstrap bootstrap = Whitebox.getInternalState(sever, "bootstrap");
Object channelInitializer = Whitebox.invoke(ServerBootstrap.class, "childHandler", bootstrap);
NettyProtocol protocol = Whitebox.getInternalState(channelInitializer, "protocol");
serverProtocol = Mockito.spy(protocol);
Whitebox.setInternalState(channelInitializer, "protocol", serverProtocol);
}
use of com.baidu.hugegraph.computer.core.network.TransportServer in project hugegraph-computer by hugegraph.
the class ConnectionManagerTest method testGetServer.
@Test
public void testGetServer() {
TransportServer server = connectionManager.getServer();
Assert.assertTrue(server.bound());
Assert.assertEquals(port, server.port());
Assert.assertNotEquals(0, server.port());
}
use of com.baidu.hugegraph.computer.core.network.TransportServer in project hugegraph-computer by hugegraph.
the class TransportConnectionManager method startServer.
@Override
public synchronized int startServer(Config config, MessageHandler serverHandler) {
E.checkArgument(this.server == null, "The TransportServer has already been listened");
E.checkArgumentNotNull(serverHandler, "The serverHandler param can't be null");
TransportConf conf = TransportConf.wrapConfig(config);
TransportServer server = conf.transportProvider().createServer(conf);
int bindPort = server.listen(config, serverHandler);
this.server = server;
return bindPort;
}
Aggregations