@Test
public void testRestProtocol() {

    URL url = URL.valueOf("rest://127.0.0.1:" + NetUtils.getAvailablePort() + "/rest/say?version=1.0.0&interface=org.apache.dubbo.rpc.protocol.rest.DemoService");
    DemoServiceImpl server = new DemoServiceImpl();
    this.registerProvider(url, server, DemoService.class);
    Exporter<DemoService> exporter = protocol.export(proxy.getInvoker(server, DemoService.class, url));
    Invoker<DemoService> invoker = protocol.refer(DemoService.class, url);
    Assertions.assertFalse(server.isCalled());
    DemoService client = proxy.getProxy(invoker);
    String result = client.sayHello("haha");
    Assertions.assertTrue(server.isCalled());
    Assertions.assertEquals("Hello, haha", result);
    invoker.destroy();
    exporter.unexport();
}