XmlRpcProtocol extends AbstractProxyProtocol { public XmlRpcProtocol() { super(XmlRpcException.class); } XmlRpcProtocol(); void setHttpBinder(HttpBinder httpBinder); @Override int getDefaultPort(); @Override void destroy(); static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER; static final String ACCESS_CONTROL_ALLOW_METHODS_HEADER; static final String ACCESS_CONTROL_ALLOW_HEADERS_HEADER; }
@Test public void testXmlRpcProtocol() { XmlRpcServiceImpl server = new XmlRpcServiceImpl(); Assertions.assertFalse(server.isCalled()); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("xmlrpc: Exporter<XmlRpcService> exporter = protocol.export(proxyFactory.getInvoker(server, XmlRpcService.class, url)); Invoker<XmlRpcService> invoker = protocol.refer(XmlRpcService.class, url); XmlRpcService client = proxyFactory.getProxy(invoker); String result = client.sayHello("haha"); Assertions.assertTrue(server.isCalled()); Assertions.assertEquals("Hello, haha", result); invoker.destroy(); exporter.unexport(); }