@Test
public void testThriftProtocol() throws TException {

    DemoServiceImpl server = new DemoServiceImpl();
    ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
    Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
    int port = NetUtils.getAvailablePort();
    URL url = URL.valueOf(org.apache.dubbo.rpc.protocol.nativethrift.ThriftProtocol.NAME + "://127.0.0.1:" + port + "/" + DemoService.Iface.class.getName() + "?version=1.0.0&nativethrift.overload.method=true");
    Exporter<DemoService.Iface> exporter = protocol.export(proxyFactory.getInvoker(server, DemoService.Iface.class, url));
    Invoker<DemoService.Iface> invoker = protocol.refer(DemoService.Iface.class, url);
    DemoService.Iface client = proxyFactory.getProxy(invoker);
    String result = client.sayHello("haha");
    Assertions.assertTrue(server.isCalled());
    Assertions.assertEquals("Hello, haha", result);
    invoker.destroy();
    exporter.unexport();
}