Search in sources :

Example 1 with NonSerialized

use of com.alibaba.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();
    protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
    service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
    try {
        service.nonSerializedParameter(new NonSerialized());
        Assert.fail();
    } catch (RpcException e) {
        Assert.assertTrue(e.getMessage().contains("com.alibaba.dubbo.rpc.protocol.dubbo.support.NonSerialized must implement java.io.Serializable"));
    }
}
Also used : NonSerialized(com.alibaba.dubbo.rpc.protocol.dubbo.support.NonSerialized) RpcException(com.alibaba.dubbo.rpc.RpcException) DemoService(com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoService) DemoServiceImpl(com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl) Test(org.junit.Test)

Aggregations

RpcException (com.alibaba.dubbo.rpc.RpcException)1 DemoService (com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoService)1 DemoServiceImpl (com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl)1 NonSerialized (com.alibaba.dubbo.rpc.protocol.dubbo.support.NonSerialized)1 Test (org.junit.Test)1