private void doTest(RpcServer rpcServer) throws InterruptedException,
ServiceException, IOException {
BlockingRpcChannel blockingChannel = RpcChannels
.newBlockingRpcChannel(clientConnectionFactory);
RpcChannel channel = RpcChannels.newRpcChannel(clientConnectionFactory,
threadPool);
BlockingInterface blockingStub = TestService
.newBlockingStub(blockingChannel);
TestService stub = TestService.newStub(channel);
try {
rpcServer.startServer();
Thread.sleep(500);
doRpc(stub);
doBlockingRpc(blockingStub);
doBlockingRpc(blockingStub);
doRpc(stub);
} finally {
Thread.sleep(500);
System.out.println("Closing Client");
if (clientConnectionFactory instanceof Closeable) {
((PersistentRpcConnectionFactory) clientConnectionFactory).close();
}
Thread.sleep(100);
System.out.println("Closing Server");
rpcServer.shutDown();
}
}
IntegrationTest.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:protobuf-socket-rpc
作者:
评论列表
文章目录