Пример #1
0
 public virtual void TestVersion2ClientVersion2Server()
 {
     // equal version client and server
     // create a server with two handlers
     TestRPCCompatibility.TestImpl2 impl = new TestRPCCompatibility.TestImpl2();
     server = new RPC.Builder(conf).SetProtocol(typeof(TestRPCCompatibility.TestProtocol2
                                                       )).SetInstance(impl).SetBindAddress(Address).SetPort(0).SetNumHandlers(2).SetVerbose
                  (false).Build();
     server.AddProtocol(RPC.RpcKind.RpcWritable, typeof(TestRPCCompatibility.TestProtocol0
                                                        ), impl);
     server.Start();
     addr = NetUtils.GetConnectAddress(server);
     TestRPCCompatibility.Version2Client client = new TestRPCCompatibility.Version2Client
                                                      (this);
     client.Ping();
     Assert.Equal("hello", client.Echo("hello"));
     // now that echo(int) is supported by the server, echo(int) should return -3
     Assert.Equal(-3, client.Echo(3));
 }
Пример #2
0
 public virtual void TestVersion2ClientVersion1Server()
 {
     // Compatible new client & old server
     // create a server with two handlers
     TestRPCCompatibility.TestImpl1 impl = new TestRPCCompatibility.TestImpl1();
     server = new RPC.Builder(conf).SetProtocol(typeof(TestRPCCompatibility.TestProtocol1
                                                       )).SetInstance(impl).SetBindAddress(Address).SetPort(0).SetNumHandlers(2).SetVerbose
                  (false).Build();
     server.AddProtocol(RPC.RpcKind.RpcWritable, typeof(TestRPCCompatibility.TestProtocol0
                                                        ), impl);
     server.Start();
     addr = NetUtils.GetConnectAddress(server);
     TestRPCCompatibility.Version2Client client = new TestRPCCompatibility.Version2Client
                                                      (this);
     client.Ping();
     Assert.Equal("hello", client.Echo("hello"));
     // echo(int) is not supported by server, so returning 3
     // This verifies that echo(int) and echo(String)'s hash codes are different
     Assert.Equal(3, client.Echo(3));
 }