Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove duplicated proto in java source tree.
- Loading branch information
Showing
4 changed files
with
78 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Set muduo.includedir in pom.xml before building. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
java/src/test/java/com/chenshuo/muduo/protorpc/RpcList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.chenshuo.muduo.protorpc; | ||
|
||
import java.net.InetSocketAddress; | ||
|
||
import com.chenshuo.muduo.protorpc.RpcServiceProto.ListRpcRequest; | ||
import com.chenshuo.muduo.protorpc.RpcServiceProto.ListRpcResponse; | ||
import com.chenshuo.muduo.protorpc.RpcServiceProto.RpcService; | ||
|
||
public class RpcList { | ||
|
||
private RpcClient client; | ||
private RpcChannel channel; | ||
RpcService.BlockingInterface rpcService; | ||
|
||
public RpcList(InetSocketAddress addr) { | ||
client = new RpcClient(); | ||
channel = client.blockingConnect(addr); | ||
rpcService = RpcService.newBlockingStub(channel); | ||
} | ||
|
||
public void close() { | ||
channel.disconnect(); | ||
client.stop(); | ||
} | ||
|
||
public void listRpc(boolean listMethod) throws Exception { | ||
ListRpcRequest request = ListRpcRequest.newBuilder().setListMethod(listMethod).build(); | ||
ListRpcResponse response = rpcService.listRpc(null, request); | ||
System.out.println(response); | ||
} | ||
|
||
public void listOneService(String service, boolean listMethod) throws Exception { | ||
ListRpcRequest request = ListRpcRequest.newBuilder().setServiceName(service).setListMethod(listMethod).build(); | ||
ListRpcResponse response = rpcService.listRpc(null, request); | ||
System.out.println(response); | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
InetSocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1])); | ||
RpcList rpcList = new RpcList(addr); | ||
rpcList.listRpc(false); | ||
rpcList.listRpc(true); | ||
rpcList.listOneService("xxx", false); | ||
rpcList.listOneService("zurg.SlaveService", false); | ||
rpcList.listOneService("zurg.SlaveService", true); | ||
rpcList.close(); | ||
} | ||
} |