Search in sources :

Example 1 with NonSerialized

use of org.apache.dubbo.rpc.protocol.dubbo.support.NonSerialized in project dubbo by alibaba.

the class DubboProtocolTest method testNonSerializedParameter.

@Test
public void testNonSerializedParameter() throws Exception {
    DemoService service = new DemoServiceImpl();
    int port = NetUtils.getAvailablePort();
    protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:" + port + "/" + DemoService.class.getName() + "?codec=exchange")));
    service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:" + port + "/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000L)));
    try {
        service.nonSerializedParameter(new NonSerialized());
        Assertions.fail();
    } catch (RpcException e) {
        Assertions.assertTrue(e.getMessage().contains("org.apache.dubbo.rpc.protocol.dubbo.support.NonSerialized must implement java.io.Serializable"));
    }
}
Also used : NonSerialized(org.apache.dubbo.rpc.protocol.dubbo.support.NonSerialized) RpcException(org.apache.dubbo.rpc.RpcException) DemoService(org.apache.dubbo.rpc.protocol.dubbo.support.DemoService) DemoServiceImpl(org.apache.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl) Test(org.junit.jupiter.api.Test)

Aggregations

RpcException (org.apache.dubbo.rpc.RpcException)1 DemoService (org.apache.dubbo.rpc.protocol.dubbo.support.DemoService)1 DemoServiceImpl (org.apache.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl)1 NonSerialized (org.apache.dubbo.rpc.protocol.dubbo.support.NonSerialized)1 Test (org.junit.jupiter.api.Test)1