使用自定义的NioSocketChannel

public class MyNioSocketChannel extends NioSocketChannel {

    @Override
    protected ChannelId newId() {

        return new ChannelId() {
            @Override
            public String asShortText() {
                return null;
            }

            @Override
            public String asLongText() {
                return null;
            }

            @Override
            public int compareTo(ChannelId o) {
                return 0;
            }
        };
    }
}