});
}
private static void test(int port) throws Exception
{
ExchangeChannel client = Exchangers.connect(URL.valueOf("dubbo://localhost:" + port));
MockResult result = (MockResult)client.request(new RpcMessage(DemoService.class.getName(),"plus",new Class<?>[]{int.class, int.class},new Object[]{55,25})).get();
System.out.println("55+25="+result.getResult());
for(int i=0;i<100;i++)
client.request(new RpcMessage(DemoService.class.getName(),"sayHello", new Class<?>[]{String.class},new Object[]{"qianlei"+i}));
for(int i=0;i<100;i++)
client.request(new Main.Data());
System.out.println("=====test invoke=====");
for(int i=0;i<100;i++){
ResponseFuture future = client.request(new Main.Data());
System.out.println("invoke and get");
System.out.println("invoke result:" + future.get());
}
System.out.println("=====the end=====");
}