@Test
public void testRestProtocolWithContextPath() {

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