@Override
    public void received(Channel channel, Object message) throws RemotingException {
        if (message instanceof Decodeable) {
            decode(message);
        }

        if (message instanceof Request) {
            decode(((Request) message).getData());
        }

        if (message instanceof Response) {
            decode(((Response) message).getResult());
        }

        handler.received(channel, message);
    }
@Test
    void test() throws Exception {
        ChannelHandler handler = Mockito.mock(ChannelHandler.class);
        Channel channel = Mockito.mock(Channel.class);
        DecodeHandler decodeHandler = new DecodeHandler(handler);

        MockData mockData = new MockData();
        decodeHandler.received(channel, mockData);
        Assertions.assertTrue(mockData.isDecoded());

        MockData mockRequestData = new MockData();
        Request request = new Request(1);
        request.setData(mockRequestData);
        decodeHandler.received(channel, request);
        Assertions.assertTrue(mockRequestData.isDecoded());

        MockData mockResponseData = new MockData();
        Response response = new Response(1);
        response.setResult(mockResponseData);
        decodeHandler.received(channel, response);
        Assertions.assertTrue(mockResponseData.isDecoded());

        mockData.setThrowEx(true);
        decodeHandler.received(channel, mockData);
    }