protected boolean isClientSide(Channel channel) {
        String side = (String) channel.getAttribute(SIDE_KEY);
        if (CLIENT_SIDE.equals(side)) {
            return true;
        } else if (SERVER_SIDE.equals(side)) {
            return false;
        } else {
            InetSocketAddress address = channel.getRemoteAddress();
            URL url = channel.getUrl();
            boolean isClient = url.getPort() == address.getPort()
                    && NetUtils.filterLocalHost(url.getIp())
                            .equals(NetUtils.filterLocalHost(
                                    address.getAddress().getHostAddress()));
            channel.setAttribute(SIDE_KEY, isClient ? CLIENT_SIDE : SERVER_SIDE);
            return isClient;
        }
    }
@Test
    void testIsClientSide() {
        AbstractCodec codec = getAbstractCodec();

        Channel channel = mock(Channel.class);
        given(channel.getRemoteAddress()).willReturn(new InetSocketAddress("172.24.157.13", 9103));
        given(channel.getUrl()).willReturn(URL.valueOf("dubbo://172.24.157.13:9103"));
        assertThat(codec.isClientSide(channel), is(true));
        assertThat(codec.isServerSide(channel), is(false));

        given(channel.getRemoteAddress()).willReturn(new InetSocketAddress("172.24.157.14", 9103));
        given(channel.getUrl()).willReturn(URL.valueOf("dubbo://172.24.157.13:9103"));
        assertThat(codec.isClientSide(channel), is(false));
        assertThat(codec.isServerSide(channel), is(true));
    }