github.com/keysonzzz/kmg@v0.0.0-20151121023212-05317bfd7d39/kmgRpc/kmgRpcJava/java/src/testPackage/Main.java (about) 1 package testPackage; 2 3 import testPackage.RpcDemo; 4 import java.lang.System; 5 import java.time.Instant; 6 import java.util.Date; 7 8 public class Main { 9 public static void main(String[] args) 10 { 11 try { 12 RpcDemo.ConfigDefaultClient("http://127.0.0.1:34895", "abc psk"); 13 String out = RpcDemo.GetDefaultClient().PostScoreInt("1", 1); 14 if (!out.equals("1")){ 15 throw new Exception("1"); 16 } 17 Date inT = RpcDemo.KmgTime.ParseGolangDate("2001-01-01T01:01:01+08:00"); 18 Date outT = RpcDemo.GetDefaultClient().DemoTime2(inT); 19 if (!RpcDemo.KmgTime.ParseGolangDate("2001-01-01T02:01:01.001+08:00").equals(outT)){ 20 throw new Exception("2 "+RpcDemo.KmgTime.FormatGolangDate(outT)); 21 } 22 inT = RpcDemo.KmgTime.ParseGolangDate("2001-01-01T01:01:01.1+08:00"); 23 outT = RpcDemo.GetDefaultClient().DemoTime(inT); 24 if (!RpcDemo.KmgTime.ParseGolangDate("2001-01-01T02:01:01.101+08:00").equals(outT)){ 25 throw new Exception("3 "+RpcDemo.KmgTime.FormatGolangDate(outT)); 26 } 27 RpcDemo.GetDefaultClient().DemoFunc4(new RpcDemo.DemoRequest(),new RpcDemo.DemoRequest()); 28 29 out = RpcDemo.GetDefaultClient().DemoClientIp(); 30 if (!out.equals("127.0.0.1")){ 31 throw new Exception("4 "+out); 32 } 33 System.out.println("Success"); 34 }catch (Exception e){ 35 System.out.println(e.getMessage()); 36 e.printStackTrace(); 37 } 38 } 39 }