IntegrationTest.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:protobuf-socket-rpc 作者:
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();
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号