|
@@ -322,6 +322,29 @@ public class TestRPC {
|
|
|
server.stop();
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testProxyAddress() throws Exception {
|
|
|
+ Server server = RPC.getServer(TestProtocol.class,
|
|
|
+ new TestImpl(), ADDRESS, 0, conf);
|
|
|
+ TestProtocol proxy = null;
|
|
|
+
|
|
|
+ try {
|
|
|
+ server.start();
|
|
|
+ InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
|
|
+
|
|
|
+ // create a client
|
|
|
+ proxy = (TestProtocol)RPC.getProxy(
|
|
|
+ TestProtocol.class, TestProtocol.versionID, addr, conf);
|
|
|
+
|
|
|
+ assertEquals(addr, RPC.getServerAddress(proxy));
|
|
|
+ } finally {
|
|
|
+ server.stop();
|
|
|
+ if (proxy != null) {
|
|
|
+ RPC.stopProxy(proxy);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testSlowRpc() throws Exception {
|
|
|
System.out.println("Testing Slow RPC");
|