Full Code of BazingaLyn/netty-study for AI

master 0b6ad325ed9c cached
149 files
357.3 KB
82.2k tokens
949 symbols
1 requests
Download .txt
Showing preview only (412K chars total). Download the full file or copy to clipboard to get everything.
Repository: BazingaLyn/netty-study
Branch: master
Commit: 0b6ad325ed9c
Files: 149
Total size: 357.3 KB

Directory structure:
gitextract_h9fdvoav/

├── README.md
├── pom.xml
└── src/
    └── main/
        ├── java/
        │   └── com/
        │       └── lyncc/
        │           └── netty/
        │               ├── attributeMap/
        │               │   ├── AttributeMapConstant.java
        │               │   ├── HelloWorld2ClientHandler.java
        │               │   ├── HelloWorldClient.java
        │               │   ├── HelloWorldClientHandler.java
        │               │   ├── HelloWorldServer.java
        │               │   ├── HelloWorldServerHandler.java
        │               │   └── NettyChannel.java
        │               ├── codec/
        │               │   ├── custom/
        │               │   │   ├── ProtocolDecoder.java
        │               │   │   ├── ProtocolEncoder.java
        │               │   │   ├── ProtocolHeader.java
        │               │   │   └── ProtocolMsg.java
        │               │   ├── jackson/
        │               │   │   ├── JacksonClient.java
        │               │   │   ├── JacksonClientHandler.java
        │               │   │   ├── JacksonClientHandlerInitializer.java
        │               │   │   ├── JacksonServer.java
        │               │   │   ├── JacksonServerHandler.java
        │               │   │   ├── JacksonServerHandlerInitializer.java
        │               │   │   ├── User.java
        │               │   │   ├── UserDecoder.java
        │               │   │   ├── UserEncoder.java
        │               │   │   └── UserMapper.java
        │               │   ├── lengthFieldBasedFrame/
        │               │   │   ├── CustomClient.java
        │               │   │   ├── CustomClientHandler.java
        │               │   │   ├── CustomDecoder.java
        │               │   │   ├── CustomEncoder.java
        │               │   │   ├── CustomMsg.java
        │               │   │   ├── CustomServer.java
        │               │   │   └── CustomServerHandler.java
        │               │   └── protobuf/
        │               │       ├── SubReqClient.java
        │               │       ├── SubReqClientHandler.java
        │               │       ├── SubReqServer.java
        │               │       ├── SubReqServerHandler.java
        │               │       ├── SubscribeReq.proto
        │               │       ├── SubscribeReqProto.java
        │               │       ├── SubscribeResp.proto
        │               │       ├── SubscribeRespProto.java
        │               │       ├── TestSubscribeReqProto.java
        │               │       └── demo/
        │               │           ├── ProtoBufClient.java
        │               │           ├── ProtoBufClientHandler.java
        │               │           ├── ProtoBufServer.java
        │               │           ├── ProtoBufServerHandler.java
        │               │           ├── RichMan.proto
        │               │           └── RichManProto.java
        │               ├── component/
        │               │   ├── channelhandler/
        │               │   │   ├── BaseClient.java
        │               │   │   ├── BaseClient1Handler.java
        │               │   │   ├── BaseClient2Handler.java
        │               │   │   ├── BaseServer.java
        │               │   │   └── BaseServerHandler.java
        │               │   └── simplehandler/
        │               │       ├── BaseClient.java
        │               │       ├── BaseClientHandler.java
        │               │       ├── BaseServer.java
        │               │       └── BaseServerHandler.java
        │               ├── concept/
        │               │   └── HelloWorldConcept.java
        │               ├── heartbeat/
        │               │   ├── BaseClient.java
        │               │   ├── BaseClientHandler.java
        │               │   ├── BaseServer.java
        │               │   └── BaseServerHandler.java
        │               ├── heartbeat2/
        │               │   ├── AskMsg.java
        │               │   ├── AskParams.java
        │               │   ├── BaseMsg.java
        │               │   ├── Constants.java
        │               │   ├── LoginMsg.java
        │               │   ├── MsgType.java
        │               │   ├── NettyChannelMap.java
        │               │   ├── NettyClientBootstrap.java
        │               │   ├── NettyClientHandler.java
        │               │   ├── NettyServerBootstrap.java
        │               │   ├── NettyServerHandler.java
        │               │   ├── PingMsg.java
        │               │   ├── ReplyBody.java
        │               │   ├── ReplyClientBody.java
        │               │   ├── ReplyMsg.java
        │               │   └── ReplyServerBody.java
        │               ├── heartbeats/
        │               │   ├── HeartBeatClientHandler.java
        │               │   ├── HeartBeatServer.java
        │               │   ├── HeartBeatServerHandler.java
        │               │   └── HeartBeatsClient.java
        │               ├── hello/
        │               │   ├── HelloWorldClient.java
        │               │   ├── HelloWorldClientHandler.java
        │               │   ├── HelloWorldServer.java
        │               │   └── HelloWorldServerHandler.java
        │               ├── idle/
        │               │   ├── AcceptorIdleStateTrigger.java
        │               │   ├── ChannelHandlerHolder.java
        │               │   ├── ConnectionWatchdog.java
        │               │   ├── ConnectorIdleStateTrigger.java
        │               │   ├── HeartBeatClientHandler.java
        │               │   ├── HeartBeatServer.java
        │               │   ├── HeartBeatServerHandler.java
        │               │   └── HeartBeatsClient.java
        │               ├── keepalive/
        │               │   ├── Constants.java
        │               │   ├── Heartbeat.java
        │               │   ├── KeepAliveClient.java
        │               │   ├── KeepAliveMessage.java
        │               │   ├── KeepAliveServer.java
        │               │   ├── KeepAliveServerInitializer.java
        │               │   └── Utils.java
        │               ├── nio/
        │               │   ├── EchoClient.java
        │               │   ├── MultiPortEchoServer.java
        │               │   └── package-info.java
        │               ├── production/
        │               │   ├── ChannelHandlerHolder.java
        │               │   ├── ConnectionWatchdog.java
        │               │   ├── client/
        │               │   │   └── connector/
        │               │   │       ├── ClientConnector.java
        │               │   │       ├── ConnectorIdleStateTrigger.java
        │               │   │       ├── DefaultCommonClientConnector.java
        │               │   │       ├── NettyClientConnector.java
        │               │   │       └── package-info.java
        │               │   ├── common/
        │               │   │   ├── Acknowledge.java
        │               │   │   ├── Heartbeats.java
        │               │   │   ├── Message.java
        │               │   │   ├── NativeSupport.java
        │               │   │   ├── NettyCommonProtocol.java
        │               │   │   ├── NettyEvent.java
        │               │   │   ├── NettyEventType.java
        │               │   │   ├── ServiceThread.java
        │               │   │   ├── exception/
        │               │   │   │   └── ConnectFailedException.java
        │               │   │   └── package-info.java
        │               │   ├── example/
        │               │   │   ├── ClientConnectorStartup.java
        │               │   │   ├── SrvAcceptorStartup.java
        │               │   │   └── package-info.java
        │               │   ├── serializer/
        │               │   │   ├── Serializer.java
        │               │   │   ├── SerializerHolder.java
        │               │   │   └── protostuff/
        │               │   │       └── ProtoStuffSerializer.java
        │               │   └── srv/
        │               │       └── acceptor/
        │               │           ├── AcceptorIdleStateTrigger.java
        │               │           ├── AcknowledgeEncoder.java
        │               │           ├── ChannelEventListener.java
        │               │           ├── DefaultCommonSrvAcceptor.java
        │               │           ├── DefaultSrvAcceptor.java
        │               │           ├── NettySrvAcceptor.java
        │               │           ├── SrvAcceptor.java
        │               │           └── package-info.java
        │               └── stickpackage/
        │                   ├── correct/
        │                   │   ├── BaseClient.java
        │                   │   ├── BaseClientHandler.java
        │                   │   ├── BaseServer.java
        │                   │   └── BaseServerHandler.java
        │                   ├── delimiter/
        │                   │   ├── BaseClient.java
        │                   │   ├── BaseClientHandler.java
        │                   │   ├── BaseServer.java
        │                   │   └── BaseServerHandler.java
        │                   ├── error/
        │                   │   ├── BaseClient.java
        │                   │   ├── BaseClientHandler.java
        │                   │   ├── BaseServer.java
        │                   │   └── BaseServerHandler.java
        │                   └── myself/
        │                       ├── BaseClient.java
        │                       ├── BaseClientHandler.java
        │                       ├── BaseServer.java
        │                       └── BaseServerHandler.java
        └── resources/
            └── logback.xml

================================================
FILE CONTENTS
================================================

================================================
FILE: README.md
================================================
# netty-study

netty4.x知识点学习



### 1) [生产级别的心跳重连](https://github.com/BazingaLyn/netty-study/tree/master/src/main/java/com/lyncc/netty/idle)

### 2) [比较规范的netty的C/S端编写](https://github.com/BazingaLyn/netty-study/tree/master/src/main/java/com/lyncc/netty/production)

   1)有心跳机制
   
   2)有ACK检验机制
   
   3)有重连机制
   
   4)自定义交互协议
   
   (代码是从Jupiter和RocketMQ中截出)


================================================
FILE: pom.xml
================================================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.study</groupId>
	<artifactId>netty-study</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>netty-study</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<version.jackson.core>2.6.3</version.jackson.core>
		<slf4j.version>1.7.5</slf4j.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.10</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>io.netty</groupId>
			<artifactId>netty-all</artifactId>
			<version>4.0.21.Final</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>${version.jackson.core}</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>${version.jackson.core}</version>
		</dependency>
		<dependency>
			<groupId>com.google.protobuf</groupId>
			<artifactId>protobuf-java</artifactId>
			<version>2.6.1</version>
		</dependency>
		<dependency>
			<groupId>io.protostuff</groupId>
			<artifactId>protostuff-core</artifactId>
			<version>1.3.5</version>
		</dependency>
		<dependency>
			<groupId>io.protostuff</groupId>
			<artifactId>protostuff-runtime</artifactId>
			<version>1.3.5</version>
		</dependency>
		<dependency>
			<groupId>org.objenesis</groupId>
			<artifactId>objenesis</artifactId>
			<version>2.1</version>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>1.0.13</version>
		</dependency>
	</dependencies>
</project>


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/AttributeMapConstant.java
================================================
package com.lyncc.netty.attributeMap;

import io.netty.util.AttributeKey;

public class AttributeMapConstant {
    
    public static final AttributeKey<NettyChannel> NETTY_CHANNEL_KEY = AttributeKey.valueOf("netty.channel");

}


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorld2ClientHandler.java
================================================
package com.lyncc.netty.attributeMap;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.Attribute;
import io.netty.util.AttributeKey;

import java.util.HashSet;

public class HelloWorld2ClientHandler extends ChannelInboundHandlerAdapter {

    public static final AttributeKey<HashSet<Integer>> NETTY_CHANNEL_KEY1 = AttributeKey.valueOf("netty.channel1");
    
    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        Attribute<HashSet<Integer>> attr = ctx.channel().attr(NETTY_CHANNEL_KEY1);
        HashSet<Integer> sets = attr.get();
        if (sets == null) {
            HashSet<Integer> newSet = new HashSet<Integer>();
            sets = attr.setIfAbsent(newSet);
            if(null == sets){
                System.out.println("GGGGGGGGGGGGGGGGGGGGGG NULLLLLLLLLLL");
                sets = newSet;
            }
            HashSet<Integer> sets2 = attr.get();
            System.out.println("RRRRRRRRRRRRRRRRR ==="+sets2.size());
            for(Integer i :sets2){
                System.out.println("value is GGGGGGGGGGG===="+i);
            }
            
        } 
        sets.add(1);
        HashSet<Integer> sets3 = attr.get();
        System.out.println("RRRRRRRRRRRRRRRRR2 ==="+sets3.size());
        System.out.println("HelloWorldC2ientHandler Active");
        ctx.fireChannelActive();
    }
    
    
    public static void main(String[] args) {
         Student student = new Student("1", 21);
         Student s =student;
         
         s.setAge(88);
         System.out.println(student.getAge());
        
    }
    
     static class Student {
       String id;
       int age;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public Student(String id, int age) {
        super();
        this.id = id;
        this.age = age;
    }
       
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        Attribute<HashSet<Integer>> attr = ctx.channel().attr(NETTY_CHANNEL_KEY1);
        HashSet<Integer> sets = attr.get();
        if (sets == null) {
           System.out.println("没有值啊");
        }else{
            for(Integer i :sets){
                System.out.println("value is ===="+i);
            }
        }
        System.out.println("HelloWorldClientHandler read Message:" + msg);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldClient.java
================================================
package com.lyncc.netty.attributeMap;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

public class HelloWorldClient {
    
    static final String HOST = System.getProperty("host", "127.0.0.1");
    static final int PORT = Integer.parseInt(System.getProperty("port", "8080"));
    static final int SIZE = Integer.parseInt(System.getProperty("size", "256"));

    public static void main(String[] args) throws Exception {
        initChannel();
    }
    
    public static void initChannel() throws InterruptedException{
        // Configure the client.
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.TCP_NODELAY, true)
             .handler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
                     ChannelPipeline p = ch.pipeline();
                     p.addLast("decoder", new StringDecoder());
                     p.addLast("encoder", new StringEncoder());
                     p.addLast(new HelloWorldClientHandler());
                     p.addLast(new HelloWorld2ClientHandler());
                 }
             });

            ChannelFuture future = b.connect(HOST, PORT).sync();
            future.channel().writeAndFlush("hello Netty,Test attributeMap");
            future.channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldClientHandler.java
================================================
package com.lyncc.netty.attributeMap;

import static com.lyncc.netty.attributeMap.AttributeMapConstant.NETTY_CHANNEL_KEY;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.Attribute;

import java.util.Date;
public class HelloWorldClientHandler extends ChannelInboundHandlerAdapter {


    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        Attribute<NettyChannel> attr = ctx.channel().attr(NETTY_CHANNEL_KEY);
        NettyChannel nChannel = attr.get();
        if (nChannel == null) {
            NettyChannel newNChannel = new NettyChannel("HelloWorld0Client", new Date());
            nChannel = attr.setIfAbsent(newNChannel);
        } else {
            System.out.println("channelActive attributeMap 中是有值的");
            System.out.println(nChannel.getName() + "=======" + nChannel.getCreateDate());
        }
        System.out.println("HelloWorldC0ientHandler Active");
        ctx.fireChannelActive();
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        Attribute<NettyChannel> attr = ctx.channel().attr(NETTY_CHANNEL_KEY);
        NettyChannel nChannel = attr.get();
        if (nChannel == null) {
            NettyChannel newNChannel = new NettyChannel("HelloWorld0Client", new Date());
            nChannel = attr.setIfAbsent(newNChannel);
        } else {
            System.out.println("channelRead attributeMap 中是有值的");
            System.out.println(nChannel.getName() + "=======" + nChannel.getCreateDate());
        }
        System.out.println("HelloWorldClientHandler read Message:" + msg);
        
        ctx.fireChannelRead(msg);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldServer.java
================================================
package com.lyncc.netty.attributeMap;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

import java.net.InetSocketAddress;

public class HelloWorldServer {

    private int port;
    
    public HelloWorldServer(int port) {
        this.port = port;
    }
    
    public void start(){
        EventLoopGroup bossGroup = new NioEventLoopGroup(1);
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap sbs = new ServerBootstrap().group(bossGroup,workerGroup).channel(NioServerSocketChannel.class).localAddress(new InetSocketAddress(port))
                    .childHandler(new ChannelInitializer<SocketChannel>() {
                        
                        protected void initChannel(SocketChannel ch) throws Exception {
                            ch.pipeline().addLast("decoder", new StringDecoder());
                            ch.pipeline().addLast("encoder", new StringEncoder());
                            ch.pipeline().addLast(new HelloWorldServerHandler());
                        };
                        
                    }).option(ChannelOption.SO_BACKLOG, 128)   
                    .childOption(ChannelOption.SO_KEEPALIVE, true);
             // 绑定端口,开始接收进来的连接
             ChannelFuture future = sbs.bind(port).sync();  
             
             System.out.println("Server start listen at " + port );
             future.channel().closeFuture().sync();
        } catch (Exception e) {
            bossGroup.shutdownGracefully();
            workerGroup.shutdownGracefully();
        }
    }
    
    public static void main(String[] args) throws Exception {
        int port;
        if (args.length > 0) {
            port = Integer.parseInt(args[0]);
        } else {
            port = 8080;
        }
        new HelloWorldServer(port).start();
    }
}


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldServerHandler.java
================================================
package com.lyncc.netty.attributeMap;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

public class HelloWorldServerHandler extends ChannelInboundHandlerAdapter{
    
    
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        System.out.println("server channelRead..");
        System.out.println(ctx.channel().remoteAddress()+"->Server :"+ msg.toString());
        ctx.write("server write"+msg);
        ctx.flush();
    }
    
    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
        ctx.close();
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/attributeMap/NettyChannel.java
================================================
package com.lyncc.netty.attributeMap;

import java.util.Date;

public class NettyChannel {
    
    private String name;
    
    
    private Date createDate;


    public NettyChannel(String name,Date createDate) {
        this.name = name;
        this.createDate = createDate;
    }

    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }


    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolDecoder.java
================================================
package com.lyncc.netty.codec.custom;


public class ProtocolDecoder{

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolEncoder.java
================================================
package com.lyncc.netty.codec.custom;

import java.nio.charset.Charset;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class ProtocolEncoder extends MessageToByteEncoder<ProtocolMsg> {

    @Override
    protected void encode(ChannelHandlerContext ctx, ProtocolMsg msg, ByteBuf out) throws Exception {
        if (null == msg || null == msg.getProtocolHeader()) {
             throw new Exception("msg is null");
        }
        
        ProtocolHeader header = msg.getProtocolHeader();
        String body = msg.getBody();
        
        byte[] bodyBytes = body.getBytes(Charset.forName("utf-8"));
        int bodySize = bodyBytes.length;
        out.writeByte(header.getMagic());
        out.writeByte(header.getMsgType());
        out.writeShort(header.getReserve());
        out.writeShort(header.getSn());
        out.writeInt(bodySize);
        out.writeBytes(bodyBytes);
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolHeader.java
================================================
package com.lyncc.netty.codec.custom;

public class ProtocolHeader {
    
    private byte magic;
    
    private byte msgType;
    
    private short reserve;
    
    private short sn;
    
    private int len;
    
    public ProtocolHeader() {
        
    }

    public byte getMagic() {
        return magic;
    }

    public void setMagic(byte magic) {
        this.magic = magic;
    }

    public byte getMsgType() {
        return msgType;
    }

    public void setMsgType(byte msgType) {
        this.msgType = msgType;
    }

    public short getReserve() {
        return reserve;
    }

    public void setReserve(short reserve) {
        this.reserve = reserve;
    }

    public short getSn() {
        return sn;
    }

    public void setSn(short sn) {
        this.sn = sn;
    }

    public int getLen() {
        return len;
    }

    public void setLen(int len) {
        this.len = len;
    }

    public ProtocolHeader(byte magic, byte msgType, short reserve, short sn, int len) {
        this.magic = magic;
        this.msgType = msgType;
        this.reserve = reserve;
        this.sn = sn;
        this.len = len;
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolMsg.java
================================================
package com.lyncc.netty.codec.custom;

public class ProtocolMsg {
    
    private ProtocolHeader protocolHeader = new ProtocolHeader();
    
    private String body;
    
    public ProtocolMsg() {
        
    }

    public ProtocolHeader getProtocolHeader() {
        return protocolHeader;
    }

    public void setProtocolHeader(ProtocolHeader protocolHeader) {
        this.protocolHeader = protocolHeader;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonClient.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

import java.util.ArrayList;
import java.util.List;


public class JacksonClient {

    private final String host;
    private final int port;

    public JacksonClient(String host, int port){
        this.host = host;
        this.port = port;
    }
    
    public static void main(String[] args) throws Exception{
        new JacksonClient("localhost", 8082).run();
    }
    
    public void run() throws Exception{
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap bootstrap  = new Bootstrap()
                    .group(group)
                    .channel(NioSocketChannel.class)
                    .handler(new JacksonClientHandlerInitializer());
            
            Channel channel = bootstrap.connect(host, port).sync().channel();

            // 发送对象
            User user = new User();
            user.setId(1);
            user.setAge(21);
            user.setName("BazingaLyncc");
            
            List<String> friends = new ArrayList<String>();
            friends.add("TED");
            friends.add("MISS");
            user.setFriends(friends);
            
            channel.write(user);
            channel.flush();
 
            // 等待连接关闭
            channel.closeFuture().sync();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            group.shutdownGracefully();
        }

    }
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonClientHandler.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class JacksonClientHandler extends SimpleChannelInboundHandler<Object>{

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
        String jsonString = "";
        if (msg instanceof User) {
            User user = (User) msg;
            
            jsonString = UserMapper.getInstance().writeValueAsString(user);  
        } else {
            jsonString = UserMapper.getInstance().writeValueAsString(msg);  
        }
        System.out.println("Client get msg form Server -" + jsonString);
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonClientHandlerInitializer.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;

public class JacksonClientHandlerInitializer extends ChannelInitializer<Channel>{

    @Override
    protected void initChannel(Channel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new UserDecoder<User>(User.class));
        pipeline.addLast(new UserEncoder());
        pipeline.addLast(new JacksonClientHandler());
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonServer.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

public class JacksonServer {
    
    static final int PORT = 8082;
    
    public static void main(String[] args) {
        
        EventLoopGroup bossGroup = new NioEventLoopGroup(1);
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        
        try {
            ServerBootstrap serverBootstrap = new ServerBootstrap().group(bossGroup,workerGroup)
                    .channel(NioServerSocketChannel.class)
                    .option(ChannelOption.SO_BACKLOG, 100)
                    .childOption(ChannelOption.SO_KEEPALIVE, true)
                    .handler(new LoggingHandler(LogLevel.INFO))
                    .childHandler(new JacksonServerHandlerInitializer());
            ChannelFuture f = serverBootstrap.bind(PORT).sync();
            
            System.out.println("Server start listen at " + PORT );
            f.channel().closeFuture().sync();
        } catch (Exception e) {
            bossGroup.shutdownGracefully();
            workerGroup.shutdownGracefully();
        }
        
        
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonServerHandler.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class JacksonServerHandler extends SimpleChannelInboundHandler<Object> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
        String jsonString = "";
        if (msg instanceof User) {
            
            User user = (User)msg;
            ctx.writeAndFlush(user);
            
            jsonString = UserMapper.getInstance().writeValueAsString(user); 
        } else {
            ctx.writeAndFlush(msg);
            jsonString = UserMapper.getInstance().writeValueAsString(msg);
        }
        System.out.println("Server get msg form Client -" + jsonString);
    }
    
    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { 
        Channel incoming = ctx.channel();
        System.out.println("SimpleChatClient:"+incoming.remoteAddress()+"异常");
        cause.printStackTrace();
        ctx.close();
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonServerHandlerInitializer.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class JacksonServerHandlerInitializer extends ChannelInitializer<SocketChannel>{

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new UserDecoder<User>(User.class));
        pipeline.addLast(new UserEncoder());
        pipeline.addLast(new JacksonServerHandler());
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/User.java
================================================
package com.lyncc.netty.codec.jackson;

import java.util.List;

public class User {
    
    private Integer id;
    
    private String name;
    
    private Integer age;
    
    private List<String> friends;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public List<String> getFriends() {
        return friends;
    }

    public void setFriends(List<String> friends) {
        this.friends = friends;
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/UserDecoder.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import java.util.List;

public class UserDecoder<T> extends ByteToMessageDecoder {
    
    private final Class<T> clazz;
    
    
    public UserDecoder(Class<T> clazz) {
        this.clazz = clazz;
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        ByteBufInputStream byteBufInputStream = new ByteBufInputStream(in);
        out.add(UserMapper.getInstance().readValue(byteBufInputStream, clazz));
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/UserEncoder.java
================================================
package com.lyncc.netty.codec.jackson;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class UserEncoder extends MessageToByteEncoder<Object>{

    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
        ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(out);
        UserMapper.getInstance().writeValue(byteBufOutputStream, msg);
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/jackson/UserMapper.java
================================================
package com.lyncc.netty.codec.jackson;

import com.fasterxml.jackson.databind.ObjectMapper;

public class UserMapper {
    
    private static final ObjectMapper MAPPER = new ObjectMapper();

    public static ObjectMapper getInstance() {
        return MAPPER;
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomClient.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;

public class CustomClient {
    
    static final String HOST = System.getProperty("host", "127.0.0.1");
    static final int PORT = Integer.parseInt(System.getProperty("port", "8080"));
    static final int SIZE = Integer.parseInt(System.getProperty("size", "256"));

    public static void main(String[] args) throws Exception {

        // Configure the client.
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.TCP_NODELAY, true)
             .handler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
                     ch.pipeline().addLast(new CustomEncoder());
                     ch.pipeline().addLast(new CustomClientHandler());
                 }
             });

            ChannelFuture future = b.connect(HOST, PORT).sync();
            future.channel().writeAndFlush("Hello Netty Server ,I am a common client");
            future.channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomClientHandler.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

public class CustomClientHandler extends ChannelInboundHandlerAdapter {
    
    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        CustomMsg customMsg = new CustomMsg((byte)0xAB, (byte)0xCD, "Hello,Netty".length(), "Hello,Netty");
        ctx.writeAndFlush(customMsg);
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomDecoder.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;

public class CustomDecoder extends LengthFieldBasedFrameDecoder {
    
    //判断传送客户端传送过来的数据是否按照协议传输,头部信息的大小应该是 byte+byte+int = 1+1+4 = 6
    private static final int HEADER_SIZE = 6;
    
    private byte type;
    
    private byte flag;
    
    private int length;
    
    private String body;

    /**
     * 
     * @param maxFrameLength 解码时,处理每个帧数据的最大长度
     * @param lengthFieldOffset 该帧数据中,存放该帧数据的长度的数据的起始位置
     * @param lengthFieldLength 记录该帧数据长度的字段本身的长度
     * @param lengthAdjustment 修改帧数据长度字段中定义的值,可以为负数
     * @param initialBytesToStrip 解析的时候需要跳过的字节数
     * @param failFast 为true,当frame长度超过maxFrameLength时立即报TooLongFrameException异常,为false,读取完整个帧再报异常
     */
    public CustomDecoder(int maxFrameLength, int lengthFieldOffset, int lengthFieldLength,
            int lengthAdjustment, int initialBytesToStrip, boolean failFast) {
        super(maxFrameLength, lengthFieldOffset, lengthFieldLength,
                lengthAdjustment, initialBytesToStrip, failFast);
    }
    
    @Override
    protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
        if (in == null) {
            return null;
        }
        if (in.readableBytes() < HEADER_SIZE) {
            throw new Exception("可读信息段比头部信息都小,你在逗我?");
        }
        
        //注意在读的过程中,readIndex的指针也在移动
        type = in.readByte();
        
        flag = in.readByte();
        
        length = in.readInt();
        
        if (in.readableBytes() < length) {
            throw new Exception("body字段你告诉我长度是"+length+",但是真实情况是没有这么多,你又逗我?");
        }
        ByteBuf buf = in.readBytes(length);
        byte[] req = new byte[buf.readableBytes()];
        buf.readBytes(req);
        body = new String(req, "UTF-8");
        
        CustomMsg customMsg = new CustomMsg(type,flag,length,body);
        return customMsg;
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomEncoder.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

import java.nio.charset.Charset;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class CustomEncoder extends MessageToByteEncoder<CustomMsg> {

    @Override
    protected void encode(ChannelHandlerContext ctx, CustomMsg msg, ByteBuf out) throws Exception {
        if(null == msg){
            throw new Exception("msg is null");
        }
        
        String body = msg.getBody();
        byte[] bodyBytes = body.getBytes(Charset.forName("utf-8"));
        out.writeByte(msg.getType());
        out.writeByte(msg.getFlag());
        out.writeInt(bodyBytes.length);
        out.writeBytes(bodyBytes);
        
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomMsg.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

public class CustomMsg {
    
    //类型  系统编号 0xAB 表示A系统,0xBC 表示B系统
    private byte type;
    
    //信息标志  0xAB 表示心跳包    0xBC 表示超时包  0xCD 业务信息包
    private byte flag;
    
    //主题信息的长度
    private int length;
    
    //主题信息
    private String body;
    
    public CustomMsg() {
        
    }
    
    public CustomMsg(byte type, byte flag, int length, String body) {
        this.type = type;
        this.flag = flag;
        this.length = length;
        this.body = body;
    }

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public byte getFlag() {
        return flag;
    }

    public void setFlag(byte flag) {
        this.flag = flag;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomServer.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;

import java.net.InetSocketAddress;

public class CustomServer {
    
    private static final int MAX_FRAME_LENGTH = 1024 * 1024;
    private static final int LENGTH_FIELD_LENGTH = 4;
    private static final int LENGTH_FIELD_OFFSET = 2;
    private static final int LENGTH_ADJUSTMENT = 0;
    private static final int INITIAL_BYTES_TO_STRIP = 0;

    private int port;
    
    public CustomServer(int port) {
        this.port = port;
    }
    
    public void start(){
        EventLoopGroup bossGroup = new NioEventLoopGroup(1);
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap sbs = new ServerBootstrap().group(bossGroup,workerGroup).channel(NioServerSocketChannel.class).localAddress(new InetSocketAddress(port))
                    .childHandler(new ChannelInitializer<SocketChannel>() {
                        
                        protected void initChannel(SocketChannel ch) throws Exception {
                             ch.pipeline().addLast(new CustomDecoder(MAX_FRAME_LENGTH,LENGTH_FIELD_LENGTH,LENGTH_FIELD_OFFSET,LENGTH_ADJUSTMENT,INITIAL_BYTES_TO_STRIP,false));
                             ch.pipeline().addLast(new CustomServerHandler());
                        };
                        
                    }).option(ChannelOption.SO_BACKLOG, 128)   
                    .childOption(ChannelOption.SO_KEEPALIVE, true);
             // 绑定端口,开始接收进来的连接
             ChannelFuture future = sbs.bind(port).sync();  
             
             System.out.println("Server start listen at " + port );
             future.channel().closeFuture().sync();
        } catch (Exception e) {
            bossGroup.shutdownGracefully();
            workerGroup.shutdownGracefully();
        }
    }
    
    public static void main(String[] args) throws Exception {
        int port;
        if (args.length > 0) {
            port = Integer.parseInt(args[0]);
        } else {
            port = 8080;
        }
        new CustomServer(port).start();
    }
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomServerHandler.java
================================================
package com.lyncc.netty.codec.lengthFieldBasedFrame;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class CustomServerHandler extends SimpleChannelInboundHandler<Object> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
        if(msg instanceof CustomMsg) {
            CustomMsg customMsg = (CustomMsg)msg;
            System.out.println("Client->Server:"+ctx.channel().remoteAddress()+" send "+customMsg.getBody());
        }
        
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqClient.java
================================================
/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package com.lyncc.netty.codec.protobuf;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.protobuf.ProtobufDecoder;
import io.netty.handler.codec.protobuf.ProtobufEncoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;

/**
 * @author lilinfeng
 * @date 2014年2月14日
 * @version 1.0
 */
public class SubReqClient {

    public void connect(int port, String host) throws Exception {
        // 配置客户端NIO线程组
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true)
                    .handler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) throws Exception {
                            ch.pipeline().addLast(new ProtobufVarint32FrameDecoder());
                            ch.pipeline().addLast(new ProtobufDecoder(SubscribeRespProto.SubscribeResp.getDefaultInstance()));
                            ch.pipeline().addLast(new ProtobufVarint32LengthFieldPrepender());
                            ch.pipeline().addLast(new ProtobufEncoder());
                            ch.pipeline().addLast(new SubReqClientHandler());
                        }
                    });

            // 发起异步连接操作
            ChannelFuture f = b.connect(host, port).sync();

            // 当代客户端链路关闭
            f.channel().closeFuture().sync();
        } finally {
            // 优雅退出,释放NIO线程组
            group.shutdownGracefully();
        }
    }

    /**
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        int port = 8080;
        if (args != null && args.length > 0) {
            try {
                port = Integer.valueOf(args[0]);
            } catch (NumberFormatException e) {
                // 采用默认值
            }
        }
        new SubReqClient().connect(port, "127.0.0.1");
    }
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqClientHandler.java
================================================
/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package com.lyncc.netty.codec.protobuf;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lilinfeng
 * @date 2014年2月14日
 * @version 1.0
 */
public class SubReqClientHandler extends ChannelInboundHandlerAdapter {

    /**
     * Creates a client-side handler.
     */
    public SubReqClientHandler() {
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        for (int i = 0; i < 10; i++) {
            ctx.write(subReq(i));
        }
        ctx.flush();
    }

    private SubscribeReqProto.SubscribeReq subReq(int i) {
        SubscribeReqProto.SubscribeReq.Builder builder = SubscribeReqProto.SubscribeReq.newBuilder();
        builder.setSubReqID(i);
        builder.setUserName("Lilinfeng");
        builder.setProductName("Netty Book For Protobuf");
        List<String> address = new ArrayList<String>();
        address.add("NanJing YuHuaTai");
        address.add("BeiJing LiuLiChang");
        address.add("ShenZhen HongShuLin");
        builder.addAllAddress(address);
        return builder.build();
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        System.out.println("Receive server response : [" + msg + "]");
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
        ctx.flush();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();
    }
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqServer.java
================================================
package com.lyncc.netty.codec.protobuf;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.protobuf.ProtobufDecoder;
import io.netty.handler.codec.protobuf.ProtobufEncoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

public class SubReqServer {

    public void bind(int port) throws Exception {
        // 配置服务端的NIO线程组
        EventLoopGroup bossGroup = new NioEventLoopGroup();
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 100)
                    .handler(new LoggingHandler(LogLevel.INFO)).childHandler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) {
                            ch.pipeline().addLast(new ProtobufVarint32FrameDecoder());
                            ch.pipeline().addLast(new ProtobufDecoder(SubscribeReqProto.SubscribeReq.getDefaultInstance()));
                            ch.pipeline().addLast(new ProtobufVarint32LengthFieldPrepender());
                            ch.pipeline().addLast(new ProtobufEncoder());
                            ch.pipeline().addLast(new SubReqServerHandler());
                        }
                    });

            // 绑定端口,同步等待成功
            ChannelFuture f = b.bind(port).sync();

            System.out.println("init start");
            // 等待服务端监听端口关闭
            f.channel().closeFuture().sync();
        } finally {
            // 优雅退出,释放线程池资源
            bossGroup.shutdownGracefully();
            workerGroup.shutdownGracefully();
        }
    }

    public static void main(String[] args) throws Exception {
        int port = 8080;
        if (args != null && args.length > 0) {
            try {
                port = Integer.valueOf(args[0]);
            } catch (NumberFormatException e) {
                // 采用默认值
            }
        }
        new SubReqServer().bind(port);
    }
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqServerHandler.java
================================================
/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package com.lyncc.netty.codec.protobuf;

import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

@Sharable
public class SubReqServerHandler extends ChannelInboundHandlerAdapter {


    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        SubscribeReqProto.SubscribeReq req = (SubscribeReqProto.SubscribeReq) msg;
        if ("Lilinfeng".equalsIgnoreCase(req.getUserName())) {
            System.out.println("Service accept client subscribe req : [" + req.toString() + "]");
            ctx.writeAndFlush(resp(req.getSubReqID()));
        }
    }

    private SubscribeRespProto.SubscribeResp resp(int subReqID) {
        SubscribeRespProto.SubscribeResp.Builder builder = SubscribeRespProto.SubscribeResp.newBuilder();
        builder.setSubReqID(subReqID);
        builder.setRespCode(0);
        builder.setDesc("Netty book order succeed, 3 days later, sent to the designated address");
        return builder.build();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();// 发生异常,关闭链路
    }
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubscribeReq.proto
================================================
package netty;  
option java_package = "com.lyncc.netty.codec.protobuf";  
option java_outer_classname = "SubscribeReqProto";  
  
message SubscribeReq{  
    required int32 subReqID = 1;  
    required string userName = 2;  
    required string productName = 3;  
    repeated string address = 4;  
} 

================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubscribeReqProto.java
================================================
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: SubscribeReq.proto

package com.lyncc.netty.codec.protobuf;

public final class SubscribeReqProto {
    private SubscribeReqProto() {
    }

    public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
    }

    public interface SubscribeReqOrBuilder extends
    // @@protoc_insertion_point(interface_extends:netty.SubscribeReq)
            com.google.protobuf.MessageOrBuilder {

        /**
         * <code>required int32 subReqID = 1;</code>
         */
        boolean hasSubReqID();

        /**
         * <code>required int32 subReqID = 1;</code>
         */
        int getSubReqID();

        /**
         * <code>required string userName = 2;</code>
         */
        boolean hasUserName();

        /**
         * <code>required string userName = 2;</code>
         */
        java.lang.String getUserName();

        /**
         * <code>required string userName = 2;</code>
         */
        com.google.protobuf.ByteString getUserNameBytes();

        /**
         * <code>required string productName = 3;</code>
         */
        boolean hasProductName();

        /**
         * <code>required string productName = 3;</code>
         */
        java.lang.String getProductName();

        /**
         * <code>required string productName = 3;</code>
         */
        com.google.protobuf.ByteString getProductNameBytes();

        /**
         * <code>repeated string address = 4;</code>
         */
        com.google.protobuf.ProtocolStringList getAddressList();

        /**
         * <code>repeated string address = 4;</code>
         */
        int getAddressCount();

        /**
         * <code>repeated string address = 4;</code>
         */
        java.lang.String getAddress(int index);

        /**
         * <code>repeated string address = 4;</code>
         */
        com.google.protobuf.ByteString getAddressBytes(int index);
    }

    /**
     * Protobuf type {@code netty.SubscribeReq}
     */
    public static final class SubscribeReq extends com.google.protobuf.GeneratedMessage implements
    // @@protoc_insertion_point(message_implements:netty.SubscribeReq)
            SubscribeReqOrBuilder {
        // Use SubscribeReq.newBuilder() to construct.
        private SubscribeReq(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
            super(builder);
            this.unknownFields = builder.getUnknownFields();
        }

        private SubscribeReq(boolean noInit) {
            this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
        }

        private static final SubscribeReq defaultInstance;

        public static SubscribeReq getDefaultInstance() {
            return defaultInstance;
        }

        public SubscribeReq getDefaultInstanceForType() {
            return defaultInstance;
        }

        private final com.google.protobuf.UnknownFieldSet unknownFields;

        @java.lang.Override
        public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
            return this.unknownFields;
        }

        private SubscribeReq(com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            initFields();
            int mutable_bitField0_ = 0;
            com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet
                    .newBuilder();
            try {
                boolean done = false;
                while (!done) {
                    int tag = input.readTag();
                    switch (tag) {
                    case 0:
                        done = true;
                        break;
                    default: {
                        if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                            done = true;
                        }
                        break;
                    }
                    case 8: {
                        bitField0_ |= 0x00000001;
                        subReqID_ = input.readInt32();
                        break;
                    }
                    case 18: {
                        com.google.protobuf.ByteString bs = input.readBytes();
                        bitField0_ |= 0x00000002;
                        userName_ = bs;
                        break;
                    }
                    case 26: {
                        com.google.protobuf.ByteString bs = input.readBytes();
                        bitField0_ |= 0x00000004;
                        productName_ = bs;
                        break;
                    }
                    case 34: {
                        com.google.protobuf.ByteString bs = input.readBytes();
                        if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                            address_ = new com.google.protobuf.LazyStringArrayList();
                            mutable_bitField0_ |= 0x00000008;
                        }
                        address_.add(bs);
                        break;
                    }
                    }
                }
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                throw e.setUnfinishedMessage(this);
            } catch (java.io.IOException e) {
                throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this);
            } finally {
                if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                    address_ = address_.getUnmodifiableView();
                }
                this.unknownFields = unknownFields.build();
                makeExtensionsImmutable();
            }
        }

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
            return com.lyncc.netty.codec.protobuf.SubscribeReqProto.internal_static_netty_SubscribeReq_descriptor;
        }

        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
            return com.lyncc.netty.codec.protobuf.SubscribeReqProto.internal_static_netty_SubscribeReq_fieldAccessorTable
                    .ensureFieldAccessorsInitialized(
                            com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.class,
                            com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.Builder.class);
        }

        public static com.google.protobuf.Parser<SubscribeReq> PARSER = new com.google.protobuf.AbstractParser<SubscribeReq>() {
            public SubscribeReq parsePartialFrom(com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                return new SubscribeReq(input, extensionRegistry);
            }
        };

        @java.lang.Override
        public com.google.protobuf.Parser<SubscribeReq> getParserForType() {
            return PARSER;
        }

        private int bitField0_;

        public static final int SUBREQID_FIELD_NUMBER = 1;

        private int subReqID_;

        /**
         * <code>required int32 subReqID = 1;</code>
         */
        public boolean hasSubReqID() {
            return ((bitField0_ & 0x00000001) == 0x00000001);
        }

        /**
         * <code>required int32 subReqID = 1;</code>
         */
        public int getSubReqID() {
            return subReqID_;
        }

        public static final int USERNAME_FIELD_NUMBER = 2;

        private java.lang.Object userName_;

        /**
         * <code>required string userName = 2;</code>
         */
        public boolean hasUserName() {
            return ((bitField0_ & 0x00000002) == 0x00000002);
        }

        /**
         * <code>required string userName = 2;</code>
         */
        public java.lang.String getUserName() {
            java.lang.Object ref = userName_;
            if (ref instanceof java.lang.String) {
                return (java.lang.String) ref;
            } else {
                com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                if (bs.isValidUtf8()) {
                    userName_ = s;
                }
                return s;
            }
        }

        /**
         * <code>required string userName = 2;</code>
         */
        public com.google.protobuf.ByteString getUserNameBytes() {
            java.lang.Object ref = userName_;
            if (ref instanceof java.lang.String) {
                com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
                userName_ = b;
                return b;
            } else {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        public static final int PRODUCTNAME_FIELD_NUMBER = 3;

        private java.lang.Object productName_;

        /**
         * <code>required string productName = 3;</code>
         */
        public boolean hasProductName() {
            return ((bitField0_ & 0x00000004) == 0x00000004);
        }

        /**
         * <code>required string productName = 3;</code>
         */
        public java.lang.String getProductName() {
            java.lang.Object ref = productName_;
            if (ref instanceof java.lang.String) {
                return (java.lang.String) ref;
            } else {
                com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                if (bs.isValidUtf8()) {
                    productName_ = s;
                }
                return s;
            }
        }

        /**
         * <code>required string productName = 3;</code>
         */
        public com.google.protobuf.ByteString getProductNameBytes() {
            java.lang.Object ref = productName_;
            if (ref instanceof java.lang.String) {
                com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
                productName_ = b;
                return b;
            } else {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        public static final int ADDRESS_FIELD_NUMBER = 4;

        private com.google.protobuf.LazyStringList address_;

        /**
         * <code>repeated string address = 4;</code>
         */
        public com.google.protobuf.ProtocolStringList getAddressList() {
            return address_;
        }

        /**
         * <code>repeated string address = 4;</code>
         */
        public int getAddressCount() {
            return address_.size();
        }

        /**
         * <code>repeated string address = 4;</code>
         */
        public java.lang.String getAddress(int index) {
            return address_.get(index);
        }

        /**
         * <code>repeated string address = 4;</code>
         */
        public com.google.protobuf.ByteString getAddressBytes(int index) {
            return address_.getByteString(index);
        }

        private void initFields() {
            subReqID_ = 0;
            userName_ = "";
            productName_ = "";
            address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
        }

        private byte memoizedIsInitialized = -1;

        public final boolean isInitialized() {
            byte isInitialized = memoizedIsInitialized;
            if (isInitialized == 1)
                return true;
            if (isInitialized == 0)
                return false;

            if (!hasSubReqID()) {
                memoizedIsInitialized = 0;
                return false;
            }
            if (!hasUserName()) {
                memoizedIsInitialized = 0;
                return false;
            }
            if (!hasProductName()) {
                memoizedIsInitialized = 0;
                return false;
            }
            memoizedIsInitialized = 1;
            return true;
        }

        public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
            getSerializedSize();
            if (((bitField0_ & 0x00000001) == 0x00000001)) {
                output.writeInt32(1, subReqID_);
            }
            if (((bitField0_ & 0x00000002) == 0x00000002)) {
                output.writeBytes(2, getUserNameBytes());
            }
            if (((bitField0_ & 0x00000004) == 0x00000004)) {
                output.writeBytes(3, getProductNameBytes());
            }
            for (int i = 0; i < address_.size(); i++) {
                output.writeBytes(4, address_.getByteString(i));
            }
            getUnknownFields().writeTo(output);
        }

        private int memoizedSerializedSize = -1;

        public int getSerializedSize() {
            int size = memoizedSerializedSize;
            if (size != -1)
                return size;

            size = 0;
            if (((bitField0_ & 0x00000001) == 0x00000001)) {
                size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, subReqID_);
            }
            if (((bitField0_ & 0x00000002) == 0x00000002)) {
                size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getUserNameBytes());
            }
            if (((bitField0_ & 0x00000004) == 0x00000004)) {
                size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getProductNameBytes());
            }
            {
                int dataSize = 0;
                for (int i = 0; i < address_.size(); i++) {
                    dataSize += com.google.protobuf.CodedOutputStream.computeBytesSizeNoTag(address_.getByteString(i));
                }
                size += dataSize;
                size += 1 * getAddressList().size();
            }
            size += getUnknownFields().getSerializedSize();
            memoizedSerializedSize = size;
            return size;
        }

        private static final long serialVersionUID = 0L;

        @java.lang.Override
        protected java.lang.Object writeReplace() throws java.io.ObjectStreamException {
            return super.writeReplace();
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(
                com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(
                com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(byte[] data)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(byte[] data,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(java.io.InputStream input)
                throws java.io.IOException {
            return PARSER.parseFrom(input);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(
                java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return PARSER.parseFrom(input, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseDelimitedFrom(
                java.io.InputStream input) throws java.io.IOException {
            return PARSER.parseDelimitedFrom(input);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseDelimitedFrom(
                java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return PARSER.parseDelimitedFrom(input, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(
                com.google.protobuf.CodedInputStream input) throws java.io.IOException {
            return PARSER.parseFrom(input);
        }

        public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parseFrom(
                com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return PARSER.parseFrom(input, extensionRegistry);
        }

        public static Builder newBuilder() {
            return Builder.create();
        }

        public Builder newBuilderForType() {
            return newBuilder();
        }

        public static Builder newBuilder(com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq prototype) {
            return newBuilder().mergeFrom(prototype);
        }

        public Builder toBuilder() {
            return newBuilder(this);
        }

        @java.lang.Override
        protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
            Builder builder = new Builder(parent);
            return builder;
        }

        /**
         * Protobuf type {@code netty.SubscribeReq}
         */
        public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:netty.SubscribeReq)
                com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReqOrBuilder {
            public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
                return com.lyncc.netty.codec.protobuf.SubscribeReqProto.internal_static_netty_SubscribeReq_descriptor;
            }

            protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
                return com.lyncc.netty.codec.protobuf.SubscribeReqProto.internal_static_netty_SubscribeReq_fieldAccessorTable
                        .ensureFieldAccessorsInitialized(
                                com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.class,
                                com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.Builder.class);
            }

            // Construct using
            // com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.newBuilder()
            private Builder() {
                maybeForceBuilderInitialization();
            }

            private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
                super(parent);
                maybeForceBuilderInitialization();
            }

            private void maybeForceBuilderInitialization() {
                if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
                }
            }

            private static Builder create() {
                return new Builder();
            }

            public Builder clear() {
                super.clear();
                subReqID_ = 0;
                bitField0_ = (bitField0_ & ~0x00000001);
                userName_ = "";
                bitField0_ = (bitField0_ & ~0x00000002);
                productName_ = "";
                bitField0_ = (bitField0_ & ~0x00000004);
                address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
                bitField0_ = (bitField0_ & ~0x00000008);
                return this;
            }

            public Builder clone() {
                return create().mergeFrom(buildPartial());
            }

            public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
                return com.lyncc.netty.codec.protobuf.SubscribeReqProto.internal_static_netty_SubscribeReq_descriptor;
            }

            public com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq getDefaultInstanceForType() {
                return com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.getDefaultInstance();
            }

            public com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq build() {
                com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq result = buildPartial();
                if (!result.isInitialized()) {
                    throw newUninitializedMessageException(result);
                }
                return result;
            }

            public com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq buildPartial() {
                com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq result = new com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq(
                        this);
                int from_bitField0_ = bitField0_;
                int to_bitField0_ = 0;
                if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
                    to_bitField0_ |= 0x00000001;
                }
                result.subReqID_ = subReqID_;
                if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
                    to_bitField0_ |= 0x00000002;
                }
                result.userName_ = userName_;
                if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
                    to_bitField0_ |= 0x00000004;
                }
                result.productName_ = productName_;
                if (((bitField0_ & 0x00000008) == 0x00000008)) {
                    address_ = address_.getUnmodifiableView();
                    bitField0_ = (bitField0_ & ~0x00000008);
                }
                result.address_ = address_;
                result.bitField0_ = to_bitField0_;
                onBuilt();
                return result;
            }

            public Builder mergeFrom(com.google.protobuf.Message other) {
                if (other instanceof com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq) {
                    return mergeFrom((com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq) other);
                } else {
                    super.mergeFrom(other);
                    return this;
                }
            }

            public Builder mergeFrom(com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq other) {
                if (other == com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq.getDefaultInstance())
                    return this;
                if (other.hasSubReqID()) {
                    setSubReqID(other.getSubReqID());
                }
                if (other.hasUserName()) {
                    bitField0_ |= 0x00000002;
                    userName_ = other.userName_;
                    onChanged();
                }
                if (other.hasProductName()) {
                    bitField0_ |= 0x00000004;
                    productName_ = other.productName_;
                    onChanged();
                }
                if (!other.address_.isEmpty()) {
                    if (address_.isEmpty()) {
                        address_ = other.address_;
                        bitField0_ = (bitField0_ & ~0x00000008);
                    } else {
                        ensureAddressIsMutable();
                        address_.addAll(other.address_);
                    }
                    onChanged();
                }
                this.mergeUnknownFields(other.getUnknownFields());
                return this;
            }

            public final boolean isInitialized() {
                if (!hasSubReqID()) {

                    return false;
                }
                if (!hasUserName()) {

                    return false;
                }
                if (!hasProductName()) {

                    return false;
                }
                return true;
            }

            public Builder mergeFrom(com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
                com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq parsedMessage = null;
                try {
                    parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
                } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                    parsedMessage = (com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeReq) e
                            .getUnfinishedMessage();
                    throw e;
                } finally {
                    if (parsedMessage != null) {
                        mergeFrom(parsedMessage);
                    }
                }
                return this;
            }

            private int bitField0_;

            private int subReqID_;

            /**
             * <code>required int32 subReqID = 1;</code>
             */
            public boolean hasSubReqID() {
                return ((bitField0_ & 0x00000001) == 0x00000001);
            }

            /**
             * <code>required int32 subReqID = 1;</code>
             */
            public int getSubReqID() {
                return subReqID_;
            }

            /**
             * <code>required int32 subReqID = 1;</code>
             */
            public Builder setSubReqID(int value) {
                bitField0_ |= 0x00000001;
                subReqID_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>required int32 subReqID = 1;</code>
             */
            public Builder clearSubReqID() {
                bitField0_ = (bitField0_ & ~0x00000001);
                subReqID_ = 0;
                onChanged();
                return this;
            }

            private java.lang.Object userName_ = "";

            /**
             * <code>required string userName = 2;</code>
             */
            public boolean hasUserName() {
                return ((bitField0_ & 0x00000002) == 0x00000002);
            }

            /**
             * <code>required string userName = 2;</code>
             */
            public java.lang.String getUserName() {
                java.lang.Object ref = userName_;
                if (!(ref instanceof java.lang.String)) {
                    com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                    java.lang.String s = bs.toStringUtf8();
                    if (bs.isValidUtf8()) {
                        userName_ = s;
                    }
                    return s;
                } else {
                    return (java.lang.String) ref;
                }
            }

            /**
             * <code>required string userName = 2;</code>
             */
            public com.google.protobuf.ByteString getUserNameBytes() {
                java.lang.Object ref = userName_;
                if (ref instanceof String) {
                    com.google.protobuf.ByteString b = com.google.protobuf.ByteString
                            .copyFromUtf8((java.lang.String) ref);
                    userName_ = b;
                    return b;
                } else {
                    return (com.google.protobuf.ByteString) ref;
                }
            }

            /**
             * <code>required string userName = 2;</code>
             */
            public Builder setUserName(java.lang.String value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000002;
                userName_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>required string userName = 2;</code>
             */
            public Builder clearUserName() {
                bitField0_ = (bitField0_ & ~0x00000002);
                userName_ = getDefaultInstance().getUserName();
                onChanged();
                return this;
            }

            /**
             * <code>required string userName = 2;</code>
             */
            public Builder setUserNameBytes(com.google.protobuf.ByteString value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000002;
                userName_ = value;
                onChanged();
                return this;
            }

            private java.lang.Object productName_ = "";

            /**
             * <code>required string productName = 3;</code>
             */
            public boolean hasProductName() {
                return ((bitField0_ & 0x00000004) == 0x00000004);
            }

            /**
             * <code>required string productName = 3;</code>
             */
            public java.lang.String getProductName() {
                java.lang.Object ref = productName_;
                if (!(ref instanceof java.lang.String)) {
                    com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                    java.lang.String s = bs.toStringUtf8();
                    if (bs.isValidUtf8()) {
                        productName_ = s;
                    }
                    return s;
                } else {
                    return (java.lang.String) ref;
                }
            }

            /**
             * <code>required string productName = 3;</code>
             */
            public com.google.protobuf.ByteString getProductNameBytes() {
                java.lang.Object ref = productName_;
                if (ref instanceof String) {
                    com.google.protobuf.ByteString b = com.google.protobuf.ByteString
                            .copyFromUtf8((java.lang.String) ref);
                    productName_ = b;
                    return b;
                } else {
                    return (com.google.protobuf.ByteString) ref;
                }
            }

            /**
             * <code>required string productName = 3;</code>
             */
            public Builder setProductName(java.lang.String value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000004;
                productName_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>required string productName = 3;</code>
             */
            public Builder clearProductName() {
                bitField0_ = (bitField0_ & ~0x00000004);
                productName_ = getDefaultInstance().getProductName();
                onChanged();
                return this;
            }

            /**
             * <code>required string productName = 3;</code>
             */
            public Builder setProductNameBytes(com.google.protobuf.ByteString value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000004;
                productName_ = value;
                onChanged();
                return this;
            }

            private com.google.protobuf.LazyStringList address_ = com.google.protobuf.LazyStringArrayList.EMPTY;

            private void ensureAddressIsMutable() {
                if (!((bitField0_ & 0x00000008) == 0x00000008)) {
                    address_ = new com.google.protobuf.LazyStringArrayList(address_);
                    bitField0_ |= 0x00000008;
                }
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public com.google.protobuf.ProtocolStringList getAddressList() {
                return address_.getUnmodifiableView();
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public int getAddressCount() {
                return address_.size();
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public java.lang.String getAddress(int index) {
                return address_.get(index);
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public com.google.protobuf.ByteString getAddressBytes(int index) {
                return address_.getByteString(index);
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public Builder setAddress(int index, java.lang.String value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureAddressIsMutable();
                address_.set(index, value);
                onChanged();
                return this;
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public Builder addAddress(java.lang.String value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureAddressIsMutable();
                address_.add(value);
                onChanged();
                return this;
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public Builder addAllAddress(java.lang.Iterable<java.lang.String> values) {
                ensureAddressIsMutable();
                com.google.protobuf.AbstractMessageLite.Builder.addAll(values, address_);
                onChanged();
                return this;
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public Builder clearAddress() {
                address_ = com.google.protobuf.LazyStringArrayList.EMPTY;
                bitField0_ = (bitField0_ & ~0x00000008);
                onChanged();
                return this;
            }

            /**
             * <code>repeated string address = 4;</code>
             */
            public Builder addAddressBytes(com.google.protobuf.ByteString value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureAddressIsMutable();
                address_.add(value);
                onChanged();
                return this;
            }

            // @@protoc_insertion_point(builder_scope:netty.SubscribeReq)
        }

        static {
            defaultInstance = new SubscribeReq(true);
            defaultInstance.initFields();
        }

        // @@protoc_insertion_point(class_scope:netty.SubscribeReq)
    }

    private static final com.google.protobuf.Descriptors.Descriptor internal_static_netty_SubscribeReq_descriptor;

    private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_netty_SubscribeReq_fieldAccessorTable;

    public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
        return descriptor;
    }

    private static com.google.protobuf.Descriptors.FileDescriptor descriptor;
    static {
        java.lang.String[] descriptorData = { "\n\022SubscribeReq.proto\022\005netty\"X\n\014Subscribe"
                + "Req\022\020\n\010subReqID\030\001 \002(\005\022\020\n\010userName\030\002 \002(\t\022"
                + "\023\n\013productName\030\003 \002(\t\022\017\n\007address\030\004 \003(\tB3\n"
                + "\036com.lyncc.netty.codec.protobufB\021Subscri" + "beReqProto" };
        com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
            public com.google.protobuf.ExtensionRegistry assignDescriptors(
                    com.google.protobuf.Descriptors.FileDescriptor root) {
                descriptor = root;
                return null;
            }
        };
        com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData,
                new com.google.protobuf.Descriptors.FileDescriptor[] {}, assigner);
        internal_static_netty_SubscribeReq_descriptor = getDescriptor().getMessageTypes().get(0);
        internal_static_netty_SubscribeReq_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(
                internal_static_netty_SubscribeReq_descriptor, new java.lang.String[] { "SubReqID", "UserName",
                        "ProductName", "Address", });
    }

    // @@protoc_insertion_point(outer_class_scope)
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubscribeResp.proto
================================================
package netty;  
option java_package = "com.lyncc.netty.codec.protobuf";  
option java_outer_classname = "SubscribeRespProto";  
  
message SubscribeReq{  
    required int32 subReqID = 1;  
    required int23 respCode = 2;  
    required string desc = 3;  
} 

================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubscribeRespProto.java
================================================
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: SubscribeResp.proto

package com.lyncc.netty.codec.protobuf;

public final class SubscribeRespProto {
  private SubscribeRespProto() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
  }
  public interface SubscribeRespOrBuilder extends
      // @@protoc_insertion_point(interface_extends:netty.SubscribeResp)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>required int32 subReqID = 1;</code>
     */
    boolean hasSubReqID();
    /**
     * <code>required int32 subReqID = 1;</code>
     */
    int getSubReqID();

    /**
     * <code>required int32 respCode = 2;</code>
     */
    boolean hasRespCode();
    /**
     * <code>required int32 respCode = 2;</code>
     */
    int getRespCode();

    /**
     * <code>required string desc = 3;</code>
     */
    boolean hasDesc();
    /**
     * <code>required string desc = 3;</code>
     */
    java.lang.String getDesc();
    /**
     * <code>required string desc = 3;</code>
     */
    com.google.protobuf.ByteString
        getDescBytes();
  }
  /**
   * Protobuf type {@code netty.SubscribeResp}
   */
  public static final class SubscribeResp extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:netty.SubscribeResp)
      SubscribeRespOrBuilder {
    // Use SubscribeResp.newBuilder() to construct.
    private SubscribeResp(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private SubscribeResp(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final SubscribeResp defaultInstance;
    public static SubscribeResp getDefaultInstance() {
      return defaultInstance;
    }

    public SubscribeResp getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private SubscribeResp(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              bitField0_ |= 0x00000001;
              subReqID_ = input.readInt32();
              break;
            }
            case 16: {
              bitField0_ |= 0x00000002;
              respCode_ = input.readInt32();
              break;
            }
            case 26: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000004;
              desc_ = bs;
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.lyncc.netty.codec.protobuf.SubscribeRespProto.internal_static_netty_SubscribeResp_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.lyncc.netty.codec.protobuf.SubscribeRespProto.internal_static_netty_SubscribeResp_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.class, com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.Builder.class);
    }

    public static com.google.protobuf.Parser<SubscribeResp> PARSER =
        new com.google.protobuf.AbstractParser<SubscribeResp>() {
      public SubscribeResp parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new SubscribeResp(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<SubscribeResp> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int SUBREQID_FIELD_NUMBER = 1;
    private int subReqID_;
    /**
     * <code>required int32 subReqID = 1;</code>
     */
    public boolean hasSubReqID() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>required int32 subReqID = 1;</code>
     */
    public int getSubReqID() {
      return subReqID_;
    }

    public static final int RESPCODE_FIELD_NUMBER = 2;
    private int respCode_;
    /**
     * <code>required int32 respCode = 2;</code>
     */
    public boolean hasRespCode() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>required int32 respCode = 2;</code>
     */
    public int getRespCode() {
      return respCode_;
    }

    public static final int DESC_FIELD_NUMBER = 3;
    private java.lang.Object desc_;
    /**
     * <code>required string desc = 3;</code>
     */
    public boolean hasDesc() {
      return ((bitField0_ & 0x00000004) == 0x00000004);
    }
    /**
     * <code>required string desc = 3;</code>
     */
    public java.lang.String getDesc() {
      java.lang.Object ref = desc_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          desc_ = s;
        }
        return s;
      }
    }
    /**
     * <code>required string desc = 3;</code>
     */
    public com.google.protobuf.ByteString
        getDescBytes() {
      java.lang.Object ref = desc_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        desc_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private void initFields() {
      subReqID_ = 0;
      respCode_ = 0;
      desc_ = "";
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasSubReqID()) {
        memoizedIsInitialized = 0;
        return false;
      }
      if (!hasRespCode()) {
        memoizedIsInitialized = 0;
        return false;
      }
      if (!hasDesc()) {
        memoizedIsInitialized = 0;
        return false;
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeInt32(1, subReqID_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeInt32(2, respCode_);
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        output.writeBytes(3, getDescBytes());
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(1, subReqID_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(2, respCode_);
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(3, getDescBytes());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code netty.SubscribeResp}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:netty.SubscribeResp)
        com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeRespOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return com.lyncc.netty.codec.protobuf.SubscribeRespProto.internal_static_netty_SubscribeResp_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.lyncc.netty.codec.protobuf.SubscribeRespProto.internal_static_netty_SubscribeResp_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.class, com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.Builder.class);
      }

      // Construct using com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        subReqID_ = 0;
        bitField0_ = (bitField0_ & ~0x00000001);
        respCode_ = 0;
        bitField0_ = (bitField0_ & ~0x00000002);
        desc_ = "";
        bitField0_ = (bitField0_ & ~0x00000004);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return com.lyncc.netty.codec.protobuf.SubscribeRespProto.internal_static_netty_SubscribeResp_descriptor;
      }

      public com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp getDefaultInstanceForType() {
        return com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.getDefaultInstance();
      }

      public com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp build() {
        com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp buildPartial() {
        com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp result = new com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.subReqID_ = subReqID_;
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000002;
        }
        result.respCode_ = respCode_;
        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
          to_bitField0_ |= 0x00000004;
        }
        result.desc_ = desc_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp) {
          return mergeFrom((com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp other) {
        if (other == com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp.getDefaultInstance()) return this;
        if (other.hasSubReqID()) {
          setSubReqID(other.getSubReqID());
        }
        if (other.hasRespCode()) {
          setRespCode(other.getRespCode());
        }
        if (other.hasDesc()) {
          bitField0_ |= 0x00000004;
          desc_ = other.desc_;
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasSubReqID()) {
          
          return false;
        }
        if (!hasRespCode()) {
          
          return false;
        }
        if (!hasDesc()) {
          
          return false;
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (com.lyncc.netty.codec.protobuf.SubscribeRespProto.SubscribeResp) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private int subReqID_ ;
      /**
       * <code>required int32 subReqID = 1;</code>
       */
      public boolean hasSubReqID() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>required int32 subReqID = 1;</code>
       */
      public int getSubReqID() {
        return subReqID_;
      }
      /**
       * <code>required int32 subReqID = 1;</code>
       */
      public Builder setSubReqID(int value) {
        bitField0_ |= 0x00000001;
        subReqID_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required int32 subReqID = 1;</code>
       */
      public Builder clearSubReqID() {
        bitField0_ = (bitField0_ & ~0x00000001);
        subReqID_ = 0;
        onChanged();
        return this;
      }

      private int respCode_ ;
      /**
       * <code>required int32 respCode = 2;</code>
       */
      public boolean hasRespCode() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>required int32 respCode = 2;</code>
       */
      public int getRespCode() {
        return respCode_;
      }
      /**
       * <code>required int32 respCode = 2;</code>
       */
      public Builder setRespCode(int value) {
        bitField0_ |= 0x00000002;
        respCode_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required int32 respCode = 2;</code>
       */
      public Builder clearRespCode() {
        bitField0_ = (bitField0_ & ~0x00000002);
        respCode_ = 0;
        onChanged();
        return this;
      }

      private java.lang.Object desc_ = "";
      /**
       * <code>required string desc = 3;</code>
       */
      public boolean hasDesc() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
      }
      /**
       * <code>required string desc = 3;</code>
       */
      public java.lang.String getDesc() {
        java.lang.Object ref = desc_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            desc_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>required string desc = 3;</code>
       */
      public com.google.protobuf.ByteString
          getDescBytes() {
        java.lang.Object ref = desc_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          desc_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>required string desc = 3;</code>
       */
      public Builder setDesc(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000004;
        desc_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required string desc = 3;</code>
       */
      public Builder clearDesc() {
        bitField0_ = (bitField0_ & ~0x00000004);
        desc_ = getDefaultInstance().getDesc();
        onChanged();
        return this;
      }
      /**
       * <code>required string desc = 3;</code>
       */
      public Builder setDescBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000004;
        desc_ = value;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:netty.SubscribeResp)
    }

    static {
      defaultInstance = new SubscribeResp(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:netty.SubscribeResp)
  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_netty_SubscribeResp_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_netty_SubscribeResp_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n\023SubscribeResp.proto\022\005netty\"A\n\rSubscrib" +
      "eResp\022\020\n\010subReqID\030\001 \002(\005\022\020\n\010respCode\030\002 \002(" +
      "\005\022\014\n\004desc\030\003 \002(\tB4\n\036com.lyncc.netty.codec" +
      ".protobufB\022SubscribeRespProto"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
          public com.google.protobuf.ExtensionRegistry assignDescriptors(
              com.google.protobuf.Descriptors.FileDescriptor root) {
            descriptor = root;
            return null;
          }
        };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        }, assigner);
    internal_static_netty_SubscribeResp_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_netty_SubscribeResp_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_netty_SubscribeResp_descriptor,
        new java.lang.String[] { "SubReqID", "RespCode", "Desc", });
  }

  // @@protoc_insertion_point(outer_class_scope)
}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/TestSubscribeReqProto.java
================================================
package com.lyncc.netty.codec.protobuf;

import java.util.ArrayList;
import java.util.List;

import com.google.protobuf.InvalidProtocolBufferException;

public class TestSubscribeReqProto {

    private static byte[] encode(SubscribeReqProto.SubscribeReq req) {
        return req.toByteArray();
    }

    private static SubscribeReqProto.SubscribeReq decode(byte[] body) throws InvalidProtocolBufferException {
        return SubscribeReqProto.SubscribeReq.parseFrom(body);
    }

    private static SubscribeReqProto.SubscribeReq createSubscribeReq() {
        SubscribeReqProto.SubscribeReq.Builder builder = SubscribeReqProto.SubscribeReq.newBuilder();
        builder.setSubReqID(1);
        builder.setUserName("Lilinfeng");
        builder.setProductName("Netty Book");
        List<String> address = new ArrayList<String>();
        address.add("NanJing YuHuaTai");
        address.add("BeiJing LiuLiChang");
        address.add("ShenZhen HongShuLin");
        builder.addAllAddress(address);
        return builder.build();
    }

    /**
     * @param args
     * @throws InvalidProtocolBufferException
     */
    public static void main(String[] args) throws InvalidProtocolBufferException {
        SubscribeReqProto.SubscribeReq req = createSubscribeReq();
        System.out.println("Before encode : " + req.toString());
        SubscribeReqProto.SubscribeReq req2 = decode(encode(req));
        System.out.println("After decode : " + req.toString());
        System.out.println("Assert equal : --> " + req2.equals(req));

    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufClient.java
================================================
package com.lyncc.netty.codec.protobuf.demo;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.protobuf.ProtobufEncoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;

public class ProtoBufClient {
    
    public void connect(int port, String host) throws Exception {
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true)
                    .handler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) throws Exception {
                            ch.pipeline().addLast(new ProtobufVarint32LengthFieldPrepender());
                            ch.pipeline().addLast(new ProtobufEncoder());
                            ch.pipeline().addLast(new ProtoBufClientHandler());
                        }
                    });

            ChannelFuture f = b.connect(host, port).sync();

            f.channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    }

    /**
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        int port = 8080;
        if (args != null && args.length > 0) {
            try {
                port = Integer.valueOf(args[0]);
            } catch (NumberFormatException e) {
                // 采用默认值
            }
        }
        new ProtoBufClient().connect(port, "127.0.0.1");
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufClientHandler.java
================================================
package com.lyncc.netty.codec.protobuf.demo;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

import java.util.ArrayList;
import java.util.List;

import com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car;
import com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType;

public class ProtoBufClientHandler extends ChannelInboundHandlerAdapter {
    
    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        System.out.println("=======================================");
        RichManProto.RichMan.Builder builder = RichManProto.RichMan.newBuilder();
        builder.setName("王思聪");
        builder.setId(1);
        builder.setEmail("wsc@163.com");
        
        List<RichManProto.RichMan.Car> cars = new ArrayList<RichManProto.RichMan.Car>();
        Car car1 = RichManProto.RichMan.Car.newBuilder().setName("上海大众超跑").setType(CarType.DASAUTO).build();
        Car car2 = RichManProto.RichMan.Car.newBuilder().setName("Aventador").setType(CarType.LAMBORGHINI).build();
        Car car3 = RichManProto.RichMan.Car.newBuilder().setName("奔驰SLS级AMG").setType(CarType.BENZ).build();
        
        cars.add(car1);
        cars.add(car2);
        cars.add(car3);
        
        builder.addAllCars(cars);
        ctx.writeAndFlush(builder.build());
    }


    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufServer.java
================================================
package com.lyncc.netty.codec.protobuf.demo;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.protobuf.ProtobufDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

public class ProtoBufServer {
    
    public void bind(int port) throws Exception {
        // 配置服务端的NIO线程组
        EventLoopGroup bossGroup = new NioEventLoopGroup();
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 100)
                    .handler(new LoggingHandler(LogLevel.INFO)).childHandler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) {
                            ch.pipeline().addLast(new ProtobufVarint32FrameDecoder());
                            ch.pipeline().addLast(new ProtobufDecoder(RichManProto.RichMan.getDefaultInstance()));
                            ch.pipeline().addLast(new ProtoBufServerHandler());
                        }
                    });

            // 绑定端口,同步等待成功
            ChannelFuture f = b.bind(port).sync();

            System.out.println("init start");
            // 等待服务端监听端口关闭
            f.channel().closeFuture().sync();
        } finally {
            // 优雅退出,释放线程池资源
            bossGroup.shutdownGracefully();
            workerGroup.shutdownGracefully();
        }
    }

    public static void main(String[] args) throws Exception {
        int port = 8080;
        if (args != null && args.length > 0) {
            try {
                port = Integer.valueOf(args[0]);
            } catch (NumberFormatException e) {
                // 采用默认值
            }
        }
        new ProtoBufServer().bind(port);
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufServerHandler.java
================================================
package com.lyncc.netty.codec.protobuf.demo;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

import java.util.List;

import com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car;

public class ProtoBufServerHandler extends ChannelInboundHandlerAdapter {
    
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        RichManProto.RichMan req = (RichManProto.RichMan) msg;
        System.out.println(req.getName()+"他有"+req.getCarsCount()+"量车");
        List<Car> lists = req.getCarsList();
        if(null != lists) {
            
            for(Car car : lists){
                System.out.println(car.getName());
            }
        }
    }


    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close(); 
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/RichMan.proto
================================================
package netty;

option java_package = "com.lyncc.netty.codec.protobuf.demo";
option java_outer_classname = "RichManProto";

message RichMan {

   required int32 id = 1;
   required string name = 2;
   optional string email = 3;
   
   enum CarType {
     AUDI = 0;
     BENZ = 1;
     LAMBORGHINI = 2;
     DASAUTO = 3;
   }
   
   message Car {
      required string name = 1;
      optional CarType type = 2 [default = BENZ];
   }
   
   repeated Car cars = 4;
   
}

================================================
FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/RichManProto.java
================================================
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: RichMan.proto

package com.lyncc.netty.codec.protobuf.demo;

public final class RichManProto {
    private RichManProto() {
    }

    public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
    }

    public interface RichManOrBuilder extends
    // @@protoc_insertion_point(interface_extends:netty.RichMan)
            com.google.protobuf.MessageOrBuilder {

        /**
         * <code>required int32 id = 1;</code>
         */
        boolean hasId();

        /**
         * <code>required int32 id = 1;</code>
         */
        int getId();

        /**
         * <code>required string name = 2;</code>
         */
        boolean hasName();

        /**
         * <code>required string name = 2;</code>
         */
        java.lang.String getName();

        /**
         * <code>required string name = 2;</code>
         */
        com.google.protobuf.ByteString getNameBytes();

        /**
         * <code>optional string email = 3;</code>
         */
        boolean hasEmail();

        /**
         * <code>optional string email = 3;</code>
         */
        java.lang.String getEmail();

        /**
         * <code>optional string email = 3;</code>
         */
        com.google.protobuf.ByteString getEmailBytes();

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car> getCarsList();

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car getCars(int index);

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        int getCarsCount();

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        java.util.List<? extends com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder> getCarsOrBuilderList();

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder getCarsOrBuilder(int index);
    }

    /**
     * Protobuf type {@code netty.RichMan}
     */
    public static final class RichMan extends com.google.protobuf.GeneratedMessage implements
    // @@protoc_insertion_point(message_implements:netty.RichMan)
            RichManOrBuilder {
        // Use RichMan.newBuilder() to construct.
        private RichMan(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
            super(builder);
            this.unknownFields = builder.getUnknownFields();
        }

        private RichMan(boolean noInit) {
            this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
        }

        private static final RichMan defaultInstance;

        public static RichMan getDefaultInstance() {
            return defaultInstance;
        }

        public RichMan getDefaultInstanceForType() {
            return defaultInstance;
        }

        private final com.google.protobuf.UnknownFieldSet unknownFields;

        @java.lang.Override
        public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
            return this.unknownFields;
        }

        private RichMan(com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            initFields();
            int mutable_bitField0_ = 0;
            com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet
                    .newBuilder();
            try {
                boolean done = false;
                while (!done) {
                    int tag = input.readTag();
                    switch (tag) {
                    case 0:
                        done = true;
                        break;
                    default: {
                        if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                            done = true;
                        }
                        break;
                    }
                    case 8: {
                        bitField0_ |= 0x00000001;
                        id_ = input.readInt32();
                        break;
                    }
                    case 18: {
                        com.google.protobuf.ByteString bs = input.readBytes();
                        bitField0_ |= 0x00000002;
                        name_ = bs;
                        break;
                    }
                    case 26: {
                        com.google.protobuf.ByteString bs = input.readBytes();
                        bitField0_ |= 0x00000004;
                        email_ = bs;
                        break;
                    }
                    case 34: {
                        if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                            cars_ = new java.util.ArrayList<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car>();
                            mutable_bitField0_ |= 0x00000008;
                        }
                        cars_.add(input.readMessage(
                                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.PARSER, extensionRegistry));
                        break;
                    }
                    }
                }
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                throw e.setUnfinishedMessage(this);
            } catch (java.io.IOException e) {
                throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this);
            } finally {
                if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                    cars_ = java.util.Collections.unmodifiableList(cars_);
                }
                this.unknownFields = unknownFields.build();
                makeExtensionsImmutable();
            }
        }

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
            return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_descriptor;
        }

        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
            return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_fieldAccessorTable
                    .ensureFieldAccessorsInitialized(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.class,
                            com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Builder.class);
        }

        public static com.google.protobuf.Parser<RichMan> PARSER = new com.google.protobuf.AbstractParser<RichMan>() {
            public RichMan parsePartialFrom(com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                return new RichMan(input, extensionRegistry);
            }
        };

        @java.lang.Override
        public com.google.protobuf.Parser<RichMan> getParserForType() {
            return PARSER;
        }

        /**
         * Protobuf enum {@code netty.RichMan.CarType}
         */
        public enum CarType implements com.google.protobuf.ProtocolMessageEnum {
            /**
             * <code>AUDI = 0;</code>
             */
            AUDI(0, 0),
            /**
             * <code>BENZ = 1;</code>
             */
            BENZ(1, 1),
            /**
             * <code>LAMBORGHINI = 2;</code>
             */
            LAMBORGHINI(2, 2),
            /**
             * <code>DASAUTO = 3;</code>
             */
            DASAUTO(3, 3), ;

            /**
             * <code>AUDI = 0;</code>
             */
            public static final int AUDI_VALUE = 0;

            /**
             * <code>BENZ = 1;</code>
             */
            public static final int BENZ_VALUE = 1;

            /**
             * <code>LAMBORGHINI = 2;</code>
             */
            public static final int LAMBORGHINI_VALUE = 2;

            /**
             * <code>DASAUTO = 3;</code>
             */
            public static final int DASAUTO_VALUE = 3;

            public final int getNumber() {
                return value;
            }

            public static CarType valueOf(int value) {
                switch (value) {
                case 0:
                    return AUDI;
                case 1:
                    return BENZ;
                case 2:
                    return LAMBORGHINI;
                case 3:
                    return DASAUTO;
                default:
                    return null;
                }
            }

            public static com.google.protobuf.Internal.EnumLiteMap<CarType> internalGetValueMap() {
                return internalValueMap;
            }

            private static com.google.protobuf.Internal.EnumLiteMap<CarType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<CarType>() {
                public CarType findValueByNumber(int number) {
                    return CarType.valueOf(number);
                }
            };

            public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
                return getDescriptor().getValues().get(index);
            }

            public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
                return getDescriptor();
            }

            public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.getDescriptor().getEnumTypes().get(0);
            }

            private static final CarType[] VALUES = values();

            public static CarType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
                if (desc.getType() != getDescriptor()) {
                    throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
                }
                return VALUES[desc.getIndex()];
            }

            private final int index;

            private final int value;

            private CarType(int index, int value) {
                this.index = index;
                this.value = value;
            }

            // @@protoc_insertion_point(enum_scope:netty.RichMan.CarType)
        }

        public interface CarOrBuilder extends
        // @@protoc_insertion_point(interface_extends:netty.RichMan.Car)
                com.google.protobuf.MessageOrBuilder {

            /**
             * <code>required string name = 1;</code>
             */
            boolean hasName();

            /**
             * <code>required string name = 1;</code>
             */
            java.lang.String getName();

            /**
             * <code>required string name = 1;</code>
             */
            com.google.protobuf.ByteString getNameBytes();

            /**
             * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
             */
            boolean hasType();

            /**
             * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
             */
            com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType getType();
        }

        /**
         * Protobuf type {@code netty.RichMan.Car}
         */
        public static final class Car extends com.google.protobuf.GeneratedMessage implements
        // @@protoc_insertion_point(message_implements:netty.RichMan.Car)
                CarOrBuilder {
            // Use Car.newBuilder() to construct.
            private Car(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
                super(builder);
                this.unknownFields = builder.getUnknownFields();
            }

            private Car(boolean noInit) {
                this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance();
            }

            private static final Car defaultInstance;

            public static Car getDefaultInstance() {
                return defaultInstance;
            }

            public Car getDefaultInstanceForType() {
                return defaultInstance;
            }

            private final com.google.protobuf.UnknownFieldSet unknownFields;

            @java.lang.Override
            public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
                return this.unknownFields;
            }

            private Car(com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                initFields();
                int mutable_bitField0_ = 0;
                com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet
                        .newBuilder();
                try {
                    boolean done = false;
                    while (!done) {
                        int tag = input.readTag();
                        switch (tag) {
                        case 0:
                            done = true;
                            break;
                        default: {
                            if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                                done = true;
                            }
                            break;
                        }
                        case 10: {
                            com.google.protobuf.ByteString bs = input.readBytes();
                            bitField0_ |= 0x00000001;
                            name_ = bs;
                            break;
                        }
                        case 16: {
                            int rawValue = input.readEnum();
                            com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType value = com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType
                                    .valueOf(rawValue);
                            if (value == null) {
                                unknownFields.mergeVarintField(2, rawValue);
                            } else {
                                bitField0_ |= 0x00000002;
                                type_ = value;
                            }
                            break;
                        }
                        }
                    }
                } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                    throw e.setUnfinishedMessage(this);
                } catch (java.io.IOException e) {
                    throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage())
                            .setUnfinishedMessage(this);
                } finally {
                    this.unknownFields = unknownFields.build();
                    makeExtensionsImmutable();
                }
            }

            public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_Car_descriptor;
            }

            protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_Car_fieldAccessorTable
                        .ensureFieldAccessorsInitialized(
                                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.class,
                                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder.class);
            }

            public static com.google.protobuf.Parser<Car> PARSER = new com.google.protobuf.AbstractParser<Car>() {
                public Car parsePartialFrom(com.google.protobuf.CodedInputStream input,
                        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                        throws com.google.protobuf.InvalidProtocolBufferException {
                    return new Car(input, extensionRegistry);
                }
            };

            @java.lang.Override
            public com.google.protobuf.Parser<Car> getParserForType() {
                return PARSER;
            }

            private int bitField0_;

            public static final int NAME_FIELD_NUMBER = 1;

            private java.lang.Object name_;

            /**
             * <code>required string name = 1;</code>
             */
            public boolean hasName() {
                return ((bitField0_ & 0x00000001) == 0x00000001);
            }

            /**
             * <code>required string name = 1;</code>
             */
            public java.lang.String getName() {
                java.lang.Object ref = name_;
                if (ref instanceof java.lang.String) {
                    return (java.lang.String) ref;
                } else {
                    com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                    java.lang.String s = bs.toStringUtf8();
                    if (bs.isValidUtf8()) {
                        name_ = s;
                    }
                    return s;
                }
            }

            /**
             * <code>required string name = 1;</code>
             */
            public com.google.protobuf.ByteString getNameBytes() {
                java.lang.Object ref = name_;
                if (ref instanceof java.lang.String) {
                    com.google.protobuf.ByteString b = com.google.protobuf.ByteString
                            .copyFromUtf8((java.lang.String) ref);
                    name_ = b;
                    return b;
                } else {
                    return (com.google.protobuf.ByteString) ref;
                }
            }

            public static final int TYPE_FIELD_NUMBER = 2;

            private com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType type_;

            /**
             * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
             */
            public boolean hasType() {
                return ((bitField0_ & 0x00000002) == 0x00000002);
            }

            /**
             * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
             */
            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType getType() {
                return type_;
            }

            private void initFields() {
                name_ = "";
                type_ = com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType.BENZ;
            }

            private byte memoizedIsInitialized = -1;

            public final boolean isInitialized() {
                byte isInitialized = memoizedIsInitialized;
                if (isInitialized == 1)
                    return true;
                if (isInitialized == 0)
                    return false;

                if (!hasName()) {
                    memoizedIsInitialized = 0;
                    return false;
                }
                memoizedIsInitialized = 1;
                return true;
            }

            public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
                getSerializedSize();
                if (((bitField0_ & 0x00000001) == 0x00000001)) {
                    output.writeBytes(1, getNameBytes());
                }
                if (((bitField0_ & 0x00000002) == 0x00000002)) {
                    output.writeEnum(2, type_.getNumber());
                }
                getUnknownFields().writeTo(output);
            }

            private int memoizedSerializedSize = -1;

            public int getSerializedSize() {
                int size = memoizedSerializedSize;
                if (size != -1)
                    return size;

                size = 0;
                if (((bitField0_ & 0x00000001) == 0x00000001)) {
                    size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getNameBytes());
                }
                if (((bitField0_ & 0x00000002) == 0x00000002)) {
                    size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, type_.getNumber());
                }
                size += getUnknownFields().getSerializedSize();
                memoizedSerializedSize = size;
                return size;
            }

            private static final long serialVersionUID = 0L;

            @java.lang.Override
            protected java.lang.Object writeReplace() throws java.io.ObjectStreamException {
                return super.writeReplace();
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(
                    com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {
                return PARSER.parseFrom(data);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(
                    com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                return PARSER.parseFrom(data, extensionRegistry);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(byte[] data)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                return PARSER.parseFrom(data);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(byte[] data,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                return PARSER.parseFrom(data, extensionRegistry);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(
                    java.io.InputStream input) throws java.io.IOException {
                return PARSER.parseFrom(input);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(
                    java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws java.io.IOException {
                return PARSER.parseFrom(input, extensionRegistry);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseDelimitedFrom(
                    java.io.InputStream input) throws java.io.IOException {
                return PARSER.parseDelimitedFrom(input);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseDelimitedFrom(
                    java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws java.io.IOException {
                return PARSER.parseDelimitedFrom(input, extensionRegistry);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(
                    com.google.protobuf.CodedInputStream input) throws java.io.IOException {
                return PARSER.parseFrom(input);
            }

            public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parseFrom(
                    com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
                return PARSER.parseFrom(input, extensionRegistry);
            }

            public static Builder newBuilder() {
                return Builder.create();
            }

            public Builder newBuilderForType() {
                return newBuilder();
            }

            public static Builder newBuilder(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car prototype) {
                return newBuilder().mergeFrom(prototype);
            }

            public Builder toBuilder() {
                return newBuilder(this);
            }

            @java.lang.Override
            protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
                Builder builder = new Builder(parent);
                return builder;
            }

            /**
             * Protobuf type {@code netty.RichMan.Car}
             */
            public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements
            // @@protoc_insertion_point(builder_implements:netty.RichMan.Car)
                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder {
                public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
                    return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_Car_descriptor;
                }

                protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
                    return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_Car_fieldAccessorTable
                            .ensureFieldAccessorsInitialized(
                                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.class,
                                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder.class);
                }

                // Construct using
                // com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.newBuilder()
                private Builder() {
                    maybeForceBuilderInitialization();
                }

                private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
                    super(parent);
                    maybeForceBuilderInitialization();
                }

                private void maybeForceBuilderInitialization() {
                    if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
                    }
                }

                private static Builder create() {
                    return new Builder();
                }

                public Builder clear() {
                    super.clear();
                    name_ = "";
                    bitField0_ = (bitField0_ & ~0x00000001);
                    type_ = com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType.BENZ;
                    bitField0_ = (bitField0_ & ~0x00000002);
                    return this;
                }

                public Builder clone() {
                    return create().mergeFrom(buildPartial());
                }

                public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
                    return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_Car_descriptor;
                }

                public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car getDefaultInstanceForType() {
                    return com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.getDefaultInstance();
                }

                public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car build() {
                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car result = buildPartial();
                    if (!result.isInitialized()) {
                        throw newUninitializedMessageException(result);
                    }
                    return result;
                }

                public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car buildPartial() {
                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car result = new com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car(
                            this);
                    int from_bitField0_ = bitField0_;
                    int to_bitField0_ = 0;
                    if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
                        to_bitField0_ |= 0x00000001;
                    }
                    result.name_ = name_;
                    if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
                        to_bitField0_ |= 0x00000002;
                    }
                    result.type_ = type_;
                    result.bitField0_ = to_bitField0_;
                    onBuilt();
                    return result;
                }

                public Builder mergeFrom(com.google.protobuf.Message other) {
                    if (other instanceof com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car) {
                        return mergeFrom((com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car) other);
                    } else {
                        super.mergeFrom(other);
                        return this;
                    }
                }

                public Builder mergeFrom(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car other) {
                    if (other == com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.getDefaultInstance())
                        return this;
                    if (other.hasName()) {
                        bitField0_ |= 0x00000001;
                        name_ = other.name_;
                        onChanged();
                    }
                    if (other.hasType()) {
                        setType(other.getType());
                    }
                    this.mergeUnknownFields(other.getUnknownFields());
                    return this;
                }

                public final boolean isInitialized() {
                    if (!hasName()) {

                        return false;
                    }
                    return true;
                }

                public Builder mergeFrom(com.google.protobuf.CodedInputStream input,
                        com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car parsedMessage = null;
                    try {
                        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
                    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                        parsedMessage = (com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car) e
                                .getUnfinishedMessage();
                        throw e;
                    } finally {
                        if (parsedMessage != null) {
                            mergeFrom(parsedMessage);
                        }
                    }
                    return this;
                }

                private int bitField0_;

                private java.lang.Object name_ = "";

                /**
                 * <code>required string name = 1;</code>
                 */
                public boolean hasName() {
                    return ((bitField0_ & 0x00000001) == 0x00000001);
                }

                /**
                 * <code>required string name = 1;</code>
                 */
                public java.lang.String getName() {
                    java.lang.Object ref = name_;
                    if (!(ref instanceof java.lang.String)) {
                        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                        java.lang.String s = bs.toStringUtf8();
                        if (bs.isValidUtf8()) {
                            name_ = s;
                        }
                        return s;
                    } else {
                        return (java.lang.String) ref;
                    }
                }

                /**
                 * <code>required string name = 1;</code>
                 */
                public com.google.protobuf.ByteString getNameBytes() {
                    java.lang.Object ref = name_;
                    if (ref instanceof String) {
                        com.google.protobuf.ByteString b = com.google.protobuf.ByteString
                                .copyFromUtf8((java.lang.String) ref);
                        name_ = b;
                        return b;
                    } else {
                        return (com.google.protobuf.ByteString) ref;
                    }
                }

                /**
                 * <code>required string name = 1;</code>
                 */
                public Builder setName(java.lang.String value) {
                    if (value == null) {
                        throw new NullPointerException();
                    }
                    bitField0_ |= 0x00000001;
                    name_ = value;
                    onChanged();
                    return this;
                }

                /**
                 * <code>required string name = 1;</code>
                 */
                public Builder clearName() {
                    bitField0_ = (bitField0_ & ~0x00000001);
                    name_ = getDefaultInstance().getName();
                    onChanged();
                    return this;
                }

                /**
                 * <code>required string name = 1;</code>
                 */
                public Builder setNameBytes(com.google.protobuf.ByteString value) {
                    if (value == null) {
                        throw new NullPointerException();
                    }
                    bitField0_ |= 0x00000001;
                    name_ = value;
                    onChanged();
                    return this;
                }

                private com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType type_ = com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType.BENZ;

                /**
                 * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
                 */
                public boolean hasType() {
                    return ((bitField0_ & 0x00000002) == 0x00000002);
                }

                /**
                 * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
                 */
                public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType getType() {
                    return type_;
                }

                /**
                 * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
                 */
                public Builder setType(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType value) {
                    if (value == null) {
                        throw new NullPointerException();
                    }
                    bitField0_ |= 0x00000002;
                    type_ = value;
                    onChanged();
                    return this;
                }

                /**
                 * <code>optional .netty.RichMan.CarType type = 2 [default = BENZ];</code>
                 */
                public Builder clearType() {
                    bitField0_ = (bitField0_ & ~0x00000002);
                    type_ = com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType.BENZ;
                    onChanged();
                    return this;
                }

                // @@protoc_insertion_point(builder_scope:netty.RichMan.Car)
            }

            static {
                defaultInstance = new Car(true);
                defaultInstance.initFields();
            }

            // @@protoc_insertion_point(class_scope:netty.RichMan.Car)
        }

        private int bitField0_;

        public static final int ID_FIELD_NUMBER = 1;

        private int id_;

        /**
         * <code>required int32 id = 1;</code>
         */
        public boolean hasId() {
            return ((bitField0_ & 0x00000001) == 0x00000001);
        }

        /**
         * <code>required int32 id = 1;</code>
         */
        public int getId() {
            return id_;
        }

        public static final int NAME_FIELD_NUMBER = 2;

        private java.lang.Object name_;

        /**
         * <code>required string name = 2;</code>
         */
        public boolean hasName() {
            return ((bitField0_ & 0x00000002) == 0x00000002);
        }

        /**
         * <code>required string name = 2;</code>
         */
        public java.lang.String getName() {
            java.lang.Object ref = name_;
            if (ref instanceof java.lang.String) {
                return (java.lang.String) ref;
            } else {
                com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                if (bs.isValidUtf8()) {
                    name_ = s;
                }
                return s;
            }
        }

        /**
         * <code>required string name = 2;</code>
         */
        public com.google.protobuf.ByteString getNameBytes() {
            java.lang.Object ref = name_;
            if (ref instanceof java.lang.String) {
                com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
                name_ = b;
                return b;
            } else {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        public static final int EMAIL_FIELD_NUMBER = 3;

        private java.lang.Object email_;

        /**
         * <code>optional string email = 3;</code>
         */
        public boolean hasEmail() {
            return ((bitField0_ & 0x00000004) == 0x00000004);
        }

        /**
         * <code>optional string email = 3;</code>
         */
        public java.lang.String getEmail() {
            java.lang.Object ref = email_;
            if (ref instanceof java.lang.String) {
                return (java.lang.String) ref;
            } else {
                com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                if (bs.isValidUtf8()) {
                    email_ = s;
                }
                return s;
            }
        }

        /**
         * <code>optional string email = 3;</code>
         */
        public com.google.protobuf.ByteString getEmailBytes() {
            java.lang.Object ref = email_;
            if (ref instanceof java.lang.String) {
                com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
                email_ = b;
                return b;
            } else {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        public static final int CARS_FIELD_NUMBER = 4;

        private java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car> cars_;

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        public java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car> getCarsList() {
            return cars_;
        }

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        public java.util.List<? extends com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder> getCarsOrBuilderList() {
            return cars_;
        }

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        public int getCarsCount() {
            return cars_.size();
        }

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car getCars(int index) {
            return cars_.get(index);
        }

        /**
         * <code>repeated .netty.RichMan.Car cars = 4;</code>
         */
        public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder getCarsOrBuilder(int index) {
            return cars_.get(index);
        }

        private void initFields() {
            id_ = 0;
            name_ = "";
            email_ = "";
            cars_ = java.util.Collections.emptyList();
        }

        private byte memoizedIsInitialized = -1;

        public final boolean isInitialized() {
            byte isInitialized = memoizedIsInitialized;
            if (isInitialized == 1)
                return true;
            if (isInitialized == 0)
                return false;

            if (!hasId()) {
                memoizedIsInitialized = 0;
                return false;
            }
            if (!hasName()) {
                memoizedIsInitialized = 0;
                return false;
            }
            for (int i = 0; i < getCarsCount(); i++) {
                if (!getCars(i).isInitialized()) {
                    memoizedIsInitialized = 0;
                    return false;
                }
            }
            memoizedIsInitialized = 1;
            return true;
        }

        public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
            getSerializedSize();
            if (((bitField0_ & 0x00000001) == 0x00000001)) {
                output.writeInt32(1, id_);
            }
            if (((bitField0_ & 0x00000002) == 0x00000002)) {
                output.writeBytes(2, getNameBytes());
            }
            if (((bitField0_ & 0x00000004) == 0x00000004)) {
                output.writeBytes(3, getEmailBytes());
            }
            for (int i = 0; i < cars_.size(); i++) {
                output.writeMessage(4, cars_.get(i));
            }
            getUnknownFields().writeTo(output);
        }

        private int memoizedSerializedSize = -1;

        public int getSerializedSize() {
            int size = memoizedSerializedSize;
            if (size != -1)
                return size;

            size = 0;
            if (((bitField0_ & 0x00000001) == 0x00000001)) {
                size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, id_);
            }
            if (((bitField0_ & 0x00000002) == 0x00000002)) {
                size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getNameBytes());
            }
            if (((bitField0_ & 0x00000004) == 0x00000004)) {
                size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getEmailBytes());
            }
            for (int i = 0; i < cars_.size(); i++) {
                size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, cars_.get(i));
            }
            size += getUnknownFields().getSerializedSize();
            memoizedSerializedSize = size;
            return size;
        }

        private static final long serialVersionUID = 0L;

        @java.lang.Override
        protected java.lang.Object writeReplace() throws java.io.ObjectStreamException {
            return super.writeReplace();
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(
                com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(
                com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(byte[] data)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(byte[] data,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(java.io.InputStream input)
                throws java.io.IOException {
            return PARSER.parseFrom(input);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(java.io.InputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
            return PARSER.parseFrom(input, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseDelimitedFrom(
                java.io.InputStream input) throws java.io.IOException {
            return PARSER.parseDelimitedFrom(input);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseDelimitedFrom(
                java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return PARSER.parseDelimitedFrom(input, extensionRegistry);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(
                com.google.protobuf.CodedInputStream input) throws java.io.IOException {
            return PARSER.parseFrom(input);
        }

        public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parseFrom(
                com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return PARSER.parseFrom(input, extensionRegistry);
        }

        public static Builder newBuilder() {
            return Builder.create();
        }

        public Builder newBuilderForType() {
            return newBuilder();
        }

        public static Builder newBuilder(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan prototype) {
            return newBuilder().mergeFrom(prototype);
        }

        public Builder toBuilder() {
            return newBuilder(this);
        }

        @java.lang.Override
        protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
            Builder builder = new Builder(parent);
            return builder;
        }

        /**
         * Protobuf type {@code netty.RichMan}
         */
        public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:netty.RichMan)
                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichManOrBuilder {
            public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_descriptor;
            }

            protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_fieldAccessorTable
                        .ensureFieldAccessorsInitialized(
                                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.class,
                                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Builder.class);
            }

            // Construct using
            // com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.newBuilder()
            private Builder() {
                maybeForceBuilderInitialization();
            }

            private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
                super(parent);
                maybeForceBuilderInitialization();
            }

            private void maybeForceBuilderInitialization() {
                if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
                    getCarsFieldBuilder();
                }
            }

            private static Builder create() {
                return new Builder();
            }

            public Builder clear() {
                super.clear();
                id_ = 0;
                bitField0_ = (bitField0_ & ~0x00000001);
                name_ = "";
                bitField0_ = (bitField0_ & ~0x00000002);
                email_ = "";
                bitField0_ = (bitField0_ & ~0x00000004);
                if (carsBuilder_ == null) {
                    cars_ = java.util.Collections.emptyList();
                    bitField0_ = (bitField0_ & ~0x00000008);
                } else {
                    carsBuilder_.clear();
                }
                return this;
            }

            public Builder clone() {
                return create().mergeFrom(buildPartial());
            }

            public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.internal_static_netty_RichMan_descriptor;
            }

            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan getDefaultInstanceForType() {
                return com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.getDefaultInstance();
            }

            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan build() {
                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan result = buildPartial();
                if (!result.isInitialized()) {
                    throw newUninitializedMessageException(result);
                }
                return result;
            }

            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan buildPartial() {
                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan result = new com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan(
                        this);
                int from_bitField0_ = bitField0_;
                int to_bitField0_ = 0;
                if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
                    to_bitField0_ |= 0x00000001;
                }
                result.id_ = id_;
                if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
                    to_bitField0_ |= 0x00000002;
                }
                result.name_ = name_;
                if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
                    to_bitField0_ |= 0x00000004;
                }
                result.email_ = email_;
                if (carsBuilder_ == null) {
                    if (((bitField0_ & 0x00000008) == 0x00000008)) {
                        cars_ = java.util.Collections.unmodifiableList(cars_);
                        bitField0_ = (bitField0_ & ~0x00000008);
                    }
                    result.cars_ = cars_;
                } else {
                    result.cars_ = carsBuilder_.build();
                }
                result.bitField0_ = to_bitField0_;
                onBuilt();
                return result;
            }

            public Builder mergeFrom(com.google.protobuf.Message other) {
                if (other instanceof com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan) {
                    return mergeFrom((com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan) other);
                } else {
                    super.mergeFrom(other);
                    return this;
                }
            }

            public Builder mergeFrom(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan other) {
                if (other == com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.getDefaultInstance())
                    return this;
                if (other.hasId()) {
                    setId(other.getId());
                }
                if (other.hasName()) {
                    bitField0_ |= 0x00000002;
                    name_ = other.name_;
                    onChanged();
                }
                if (other.hasEmail()) {
                    bitField0_ |= 0x00000004;
                    email_ = other.email_;
                    onChanged();
                }
                if (carsBuilder_ == null) {
                    if (!other.cars_.isEmpty()) {
                        if (cars_.isEmpty()) {
                            cars_ = other.cars_;
                            bitField0_ = (bitField0_ & ~0x00000008);
                        } else {
                            ensureCarsIsMutable();
                            cars_.addAll(other.cars_);
                        }
                        onChanged();
                    }
                } else {
                    if (!other.cars_.isEmpty()) {
                        if (carsBuilder_.isEmpty()) {
                            carsBuilder_.dispose();
                            carsBuilder_ = null;
                            cars_ = other.cars_;
                            bitField0_ = (bitField0_ & ~0x00000008);
                            carsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getCarsFieldBuilder()
                                    : null;
                        } else {
                            carsBuilder_.addAllMessages(other.cars_);
                        }
                    }
                }
                this.mergeUnknownFields(other.getUnknownFields());
                return this;
            }

            public final boolean isInitialized() {
                if (!hasId()) {

                    return false;
                }
                if (!hasName()) {

                    return false;
                }
                for (int i = 0; i < getCarsCount(); i++) {
                    if (!getCars(i).isInitialized()) {

                        return false;
                    }
                }
                return true;
            }

            public Builder mergeFrom(com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
                com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan parsedMessage = null;
                try {
                    parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
                } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                    parsedMessage = (com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan) e.getUnfinishedMessage();
                    throw e;
                } finally {
                    if (parsedMessage != null) {
                        mergeFrom(parsedMessage);
                    }
                }
                return this;
            }

            private int bitField0_;

            private int id_;

            /**
             * <code>required int32 id = 1;</code>
             */
            public boolean hasId() {
                return ((bitField0_ & 0x00000001) == 0x00000001);
            }

            /**
             * <code>required int32 id = 1;</code>
             */
            public int getId() {
                return id_;
            }

            /**
             * <code>required int32 id = 1;</code>
             */
            public Builder setId(int value) {
                bitField0_ |= 0x00000001;
                id_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>required int32 id = 1;</code>
             */
            public Builder clearId() {
                bitField0_ = (bitField0_ & ~0x00000001);
                id_ = 0;
                onChanged();
                return this;
            }

            private java.lang.Object name_ = "";

            /**
             * <code>required string name = 2;</code>
             */
            public boolean hasName() {
                return ((bitField0_ & 0x00000002) == 0x00000002);
            }

            /**
             * <code>required string name = 2;</code>
             */
            public java.lang.String getName() {
                java.lang.Object ref = name_;
                if (!(ref instanceof java.lang.String)) {
                    com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                    java.lang.String s = bs.toStringUtf8();
                    if (bs.isValidUtf8()) {
                        name_ = s;
                    }
                    return s;
                } else {
                    return (java.lang.String) ref;
                }
            }

            /**
             * <code>required string name = 2;</code>
             */
            public com.google.protobuf.ByteString getNameBytes() {
                java.lang.Object ref = name_;
                if (ref instanceof String) {
                    com.google.protobuf.ByteString b = com.google.protobuf.ByteString
                            .copyFromUtf8((java.lang.String) ref);
                    name_ = b;
                    return b;
                } else {
                    return (com.google.protobuf.ByteString) ref;
                }
            }

            /**
             * <code>required string name = 2;</code>
             */
            public Builder setName(java.lang.String value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000002;
                name_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>required string name = 2;</code>
             */
            public Builder clearName() {
                bitField0_ = (bitField0_ & ~0x00000002);
                name_ = getDefaultInstance().getName();
                onChanged();
                return this;
            }

            /**
             * <code>required string name = 2;</code>
             */
            public Builder setNameBytes(com.google.protobuf.ByteString value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000002;
                name_ = value;
                onChanged();
                return this;
            }

            private java.lang.Object email_ = "";

            /**
             * <code>optional string email = 3;</code>
             */
            public boolean hasEmail() {
                return ((bitField0_ & 0x00000004) == 0x00000004);
            }

            /**
             * <code>optional string email = 3;</code>
             */
            public java.lang.String getEmail() {
                java.lang.Object ref = email_;
                if (!(ref instanceof java.lang.String)) {
                    com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
                    java.lang.String s = bs.toStringUtf8();
                    if (bs.isValidUtf8()) {
                        email_ = s;
                    }
                    return s;
                } else {
                    return (java.lang.String) ref;
                }
            }

            /**
             * <code>optional string email = 3;</code>
             */
            public com.google.protobuf.ByteString getEmailBytes() {
                java.lang.Object ref = email_;
                if (ref instanceof String) {
                    com.google.protobuf.ByteString b = com.google.protobuf.ByteString
                            .copyFromUtf8((java.lang.String) ref);
                    email_ = b;
                    return b;
                } else {
                    return (com.google.protobuf.ByteString) ref;
                }
            }

            /**
             * <code>optional string email = 3;</code>
             */
            public Builder setEmail(java.lang.String value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000004;
                email_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>optional string email = 3;</code>
             */
            public Builder clearEmail() {
                bitField0_ = (bitField0_ & ~0x00000004);
                email_ = getDefaultInstance().getEmail();
                onChanged();
                return this;
            }

            /**
             * <code>optional string email = 3;</code>
             */
            public Builder setEmailBytes(com.google.protobuf.ByteString value) {
                if (value == null) {
                    throw new NullPointerException();
                }
                bitField0_ |= 0x00000004;
                email_ = value;
                onChanged();
                return this;
            }

            private java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car> cars_ = java.util.Collections
                    .emptyList();

            private void ensureCarsIsMutable() {
                if (!((bitField0_ & 0x00000008) == 0x00000008)) {
                    cars_ = new java.util.ArrayList<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car>(cars_);
                    bitField0_ |= 0x00000008;
                }
            }

            private com.google.protobuf.RepeatedFieldBuilder<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder> carsBuilder_;

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car> getCarsList() {
                if (carsBuilder_ == null) {
                    return java.util.Collections.unmodifiableList(cars_);
                } else {
                    return carsBuilder_.getMessageList();
                }
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public int getCarsCount() {
                if (carsBuilder_ == null) {
                    return cars_.size();
                } else {
                    return carsBuilder_.getCount();
                }
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car getCars(int index) {
                if (carsBuilder_ == null) {
                    return cars_.get(index);
                } else {
                    return carsBuilder_.getMessage(index);
                }
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder setCars(int index, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car value) {
                if (carsBuilder_ == null) {
                    if (value == null) {
                        throw new NullPointerException();
                    }
                    ensureCarsIsMutable();
                    cars_.set(index, value);
                    onChanged();
                } else {
                    carsBuilder_.setMessage(index, value);
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder setCars(int index,
                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder builderForValue) {
                if (carsBuilder_ == null) {
                    ensureCarsIsMutable();
                    cars_.set(index, builderForValue.build());
                    onChanged();
                } else {
                    carsBuilder_.setMessage(index, builderForValue.build());
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder addCars(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car value) {
                if (carsBuilder_ == null) {
                    if (value == null) {
                        throw new NullPointerException();
                    }
                    ensureCarsIsMutable();
                    cars_.add(value);
                    onChanged();
                } else {
                    carsBuilder_.addMessage(value);
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder addCars(int index, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car value) {
                if (carsBuilder_ == null) {
                    if (value == null) {
                        throw new NullPointerException();
                    }
                    ensureCarsIsMutable();
                    cars_.add(index, value);
                    onChanged();
                } else {
                    carsBuilder_.addMessage(index, value);
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder addCars(com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder builderForValue) {
                if (carsBuilder_ == null) {
                    ensureCarsIsMutable();
                    cars_.add(builderForValue.build());
                    onChanged();
                } else {
                    carsBuilder_.addMessage(builderForValue.build());
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder addCars(int index,
                    com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder builderForValue) {
                if (carsBuilder_ == null) {
                    ensureCarsIsMutable();
                    cars_.add(index, builderForValue.build());
                    onChanged();
                } else {
                    carsBuilder_.addMessage(index, builderForValue.build());
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder addAllCars(
                    java.lang.Iterable<? extends com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car> values) {
                if (carsBuilder_ == null) {
                    ensureCarsIsMutable();
                    com.google.protobuf.AbstractMessageLite.Builder.addAll(values, cars_);
                    onChanged();
                } else {
                    carsBuilder_.addAllMessages(values);
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder clearCars() {
                if (carsBuilder_ == null) {
                    cars_ = java.util.Collections.emptyList();
                    bitField0_ = (bitField0_ & ~0x00000008);
                    onChanged();
                } else {
                    carsBuilder_.clear();
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public Builder removeCars(int index) {
                if (carsBuilder_ == null) {
                    ensureCarsIsMutable();
                    cars_.remove(index);
                    onChanged();
                } else {
                    carsBuilder_.remove(index);
                }
                return this;
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder getCarsBuilder(int index) {
                return getCarsFieldBuilder().getBuilder(index);
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder getCarsOrBuilder(int index) {
                if (carsBuilder_ == null) {
                    return cars_.get(index);
                } else {
                    return carsBuilder_.getMessageOrBuilder(index);
                }
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public java.util.List<? extends com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder> getCarsOrBuilderList() {
                if (carsBuilder_ != null) {
                    return carsBuilder_.getMessageOrBuilderList();
                } else {
                    return java.util.Collections.unmodifiableList(cars_);
                }
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder addCarsBuilder() {
                return getCarsFieldBuilder().addBuilder(
                        com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.getDefaultInstance());
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder addCarsBuilder(int index) {
                return getCarsFieldBuilder().addBuilder(index,
                        com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.getDefaultInstance());
            }

            /**
             * <code>repeated .netty.RichMan.Car cars = 4;</code>
             */
            public java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder> getCarsBuilderList() {
                return getCarsFieldBuilder().getBuilderList();
            }

            private com.google.protobuf.RepeatedFieldBuilder<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder> getCarsFieldBuilder() {
                if (carsBuilder_ == null) {
                    carsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car.Builder, com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilder>(
                            cars_, ((bitField0_ & 0x00000008) == 0x00000008), getParentForChildren(), isClean());
                    cars_ = null;
                }
                return carsBuilder_;
            }

            // @@protoc_insertion_point(builder_scope:netty.RichMan)
        }

        static {
            defaultInstance = new RichMan(true);
            defaultInstance.initFields();
        }

        // @@protoc_insertion_point(class_scope:netty.RichMan)
    }

    private static final com.google.protobuf.Descriptors.Descriptor internal_static_netty_RichMan_descriptor;

    private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_netty_RichMan_fieldAccessorTable;

    private static final com.google.protobuf.Descriptors.Descriptor internal_static_netty_RichMan_Car_descriptor;

    private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_netty_RichMan_Car_fieldAccessorTable;

    public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
        return descriptor;
    }

    private static com.google.protobuf.Descriptors.FileDescriptor descriptor;
    static {
        java.lang.String[] descriptorData = { "\n\rRichMan.proto\022\005netty\"\322\001\n\007RichMan\022\n\n\002id"
                + "\030\001 \002(\005\022\014\n\004name\030\002 \002(\t\022\r\n\005email\030\003 \001(\t\022 \n\004c"
                + "ars\030\004 \003(\0132\022.netty.RichMan.Car\032?\n\003Car\022\014\n\004"
                + "name\030\001 \002(\t\022*\n\004type\030\002 \001(\0162\026.netty.RichMan"
                + ".CarType:\004BENZ\";\n\007CarType\022\010\n\004AUDI\020\000\022\010\n\004B"
                + "ENZ\020\001\022\017\n\013LAMBORGHINI\020\002\022\013\n\007DASAUTO\020\003B3\n#c"
                + "om.lyncc.netty.codec.protobuf.demoB\014Rich" + "ManProto" };
        com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
            public com.google.protobuf.ExtensionRegistry assignDescriptors(
                    com.google.protobuf.Descriptors.FileDescriptor root) {
                descriptor = root;
                return null;
            }
        };
        com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData,
                new com.google.protobuf.Descriptors.FileDescriptor[] {}, assigner);
        internal_static_netty_RichMan_descriptor = getDescriptor().getMessageTypes().get(0);
        internal_static_netty_RichMan_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(
                internal_static_netty_RichMan_descriptor, new java.lang.String[] { "Id", "Name", "Email", "Cars", });
        internal_static_netty_RichMan_Car_descriptor = internal_static_netty_RichMan_descriptor.getNestedTypes().get(0);
        internal_static_netty_RichMan_Car_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(
                internal_static_netty_RichMan_Car_descriptor, new java.lang.String[] { "Name", "Type", });
    }

    // @@protoc_insertion_point(outer_class_scope)
}


================================================
FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseClient.java
================================================
package com.lyncc.netty.component.channelhandler;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

public class BaseClient {
    
    static final String HOST = System.getProperty("host", "127.0.0.1");
    static final int PORT = Integer.parseInt(System.getProperty("port", "8080"));
    static final int SIZE = Integer.parseInt(System.getProperty("size", "256"));

    public static void main(String[] args) throws Exception {

        // Configure the client.
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.TCP_NODELAY, true)
             .handler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
                     ChannelPipeline p = ch.pipeline();
                     p.addLast("decoder", new StringDecoder());
                     p.addLast("encoder", new StringEncoder());
                     p.addLast(new BaseClient1Handler());
                     p.addLast(new BaseClient2Handler());
                 }
             });

            ChannelFuture future = b.connect(HOST, PORT).sync();
            future.channel().writeAndFlush("Hello Netty Server ,I am a common client");
            future.channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    }

}


================================================
FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseClient1Handler.java
================================================
package com.lyncc.netty.component.channelhandler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * 
 * @author bazingaLyncc
 * 描述:客户端的第一个自定义的inbound处理器
 * 时间  2016年5月3日
 */
public class BaseClient1Handler extends ChannelInboundHandlerAdapter{
    
    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Excep
Download .txt
gitextract_h9fdvoav/

├── README.md
├── pom.xml
└── src/
    └── main/
        ├── java/
        │   └── com/
        │       └── lyncc/
        │           └── netty/
        │               ├── attributeMap/
        │               │   ├── AttributeMapConstant.java
        │               │   ├── HelloWorld2ClientHandler.java
        │               │   ├── HelloWorldClient.java
        │               │   ├── HelloWorldClientHandler.java
        │               │   ├── HelloWorldServer.java
        │               │   ├── HelloWorldServerHandler.java
        │               │   └── NettyChannel.java
        │               ├── codec/
        │               │   ├── custom/
        │               │   │   ├── ProtocolDecoder.java
        │               │   │   ├── ProtocolEncoder.java
        │               │   │   ├── ProtocolHeader.java
        │               │   │   └── ProtocolMsg.java
        │               │   ├── jackson/
        │               │   │   ├── JacksonClient.java
        │               │   │   ├── JacksonClientHandler.java
        │               │   │   ├── JacksonClientHandlerInitializer.java
        │               │   │   ├── JacksonServer.java
        │               │   │   ├── JacksonServerHandler.java
        │               │   │   ├── JacksonServerHandlerInitializer.java
        │               │   │   ├── User.java
        │               │   │   ├── UserDecoder.java
        │               │   │   ├── UserEncoder.java
        │               │   │   └── UserMapper.java
        │               │   ├── lengthFieldBasedFrame/
        │               │   │   ├── CustomClient.java
        │               │   │   ├── CustomClientHandler.java
        │               │   │   ├── CustomDecoder.java
        │               │   │   ├── CustomEncoder.java
        │               │   │   ├── CustomMsg.java
        │               │   │   ├── CustomServer.java
        │               │   │   └── CustomServerHandler.java
        │               │   └── protobuf/
        │               │       ├── SubReqClient.java
        │               │       ├── SubReqClientHandler.java
        │               │       ├── SubReqServer.java
        │               │       ├── SubReqServerHandler.java
        │               │       ├── SubscribeReq.proto
        │               │       ├── SubscribeReqProto.java
        │               │       ├── SubscribeResp.proto
        │               │       ├── SubscribeRespProto.java
        │               │       ├── TestSubscribeReqProto.java
        │               │       └── demo/
        │               │           ├── ProtoBufClient.java
        │               │           ├── ProtoBufClientHandler.java
        │               │           ├── ProtoBufServer.java
        │               │           ├── ProtoBufServerHandler.java
        │               │           ├── RichMan.proto
        │               │           └── RichManProto.java
        │               ├── component/
        │               │   ├── channelhandler/
        │               │   │   ├── BaseClient.java
        │               │   │   ├── BaseClient1Handler.java
        │               │   │   ├── BaseClient2Handler.java
        │               │   │   ├── BaseServer.java
        │               │   │   └── BaseServerHandler.java
        │               │   └── simplehandler/
        │               │       ├── BaseClient.java
        │               │       ├── BaseClientHandler.java
        │               │       ├── BaseServer.java
        │               │       └── BaseServerHandler.java
        │               ├── concept/
        │               │   └── HelloWorldConcept.java
        │               ├── heartbeat/
        │               │   ├── BaseClient.java
        │               │   ├── BaseClientHandler.java
        │               │   ├── BaseServer.java
        │               │   └── BaseServerHandler.java
        │               ├── heartbeat2/
        │               │   ├── AskMsg.java
        │               │   ├── AskParams.java
        │               │   ├── BaseMsg.java
        │               │   ├── Constants.java
        │               │   ├── LoginMsg.java
        │               │   ├── MsgType.java
        │               │   ├── NettyChannelMap.java
        │               │   ├── NettyClientBootstrap.java
        │               │   ├── NettyClientHandler.java
        │               │   ├── NettyServerBootstrap.java
        │               │   ├── NettyServerHandler.java
        │               │   ├── PingMsg.java
        │               │   ├── ReplyBody.java
        │               │   ├── ReplyClientBody.java
        │               │   ├── ReplyMsg.java
        │               │   └── ReplyServerBody.java
        │               ├── heartbeats/
        │               │   ├── HeartBeatClientHandler.java
        │               │   ├── HeartBeatServer.java
        │               │   ├── HeartBeatServerHandler.java
        │               │   └── HeartBeatsClient.java
        │               ├── hello/
        │               │   ├── HelloWorldClient.java
        │               │   ├── HelloWorldClientHandler.java
        │               │   ├── HelloWorldServer.java
        │               │   └── HelloWorldServerHandler.java
        │               ├── idle/
        │               │   ├── AcceptorIdleStateTrigger.java
        │               │   ├── ChannelHandlerHolder.java
        │               │   ├── ConnectionWatchdog.java
        │               │   ├── ConnectorIdleStateTrigger.java
        │               │   ├── HeartBeatClientHandler.java
        │               │   ├── HeartBeatServer.java
        │               │   ├── HeartBeatServerHandler.java
        │               │   └── HeartBeatsClient.java
        │               ├── keepalive/
        │               │   ├── Constants.java
        │               │   ├── Heartbeat.java
        │               │   ├── KeepAliveClient.java
        │               │   ├── KeepAliveMessage.java
        │               │   ├── KeepAliveServer.java
        │               │   ├── KeepAliveServerInitializer.java
        │               │   └── Utils.java
        │               ├── nio/
        │               │   ├── EchoClient.java
        │               │   ├── MultiPortEchoServer.java
        │               │   └── package-info.java
        │               ├── production/
        │               │   ├── ChannelHandlerHolder.java
        │               │   ├── ConnectionWatchdog.java
        │               │   ├── client/
        │               │   │   └── connector/
        │               │   │       ├── ClientConnector.java
        │               │   │       ├── ConnectorIdleStateTrigger.java
        │               │   │       ├── DefaultCommonClientConnector.java
        │               │   │       ├── NettyClientConnector.java
        │               │   │       └── package-info.java
        │               │   ├── common/
        │               │   │   ├── Acknowledge.java
        │               │   │   ├── Heartbeats.java
        │               │   │   ├── Message.java
        │               │   │   ├── NativeSupport.java
        │               │   │   ├── NettyCommonProtocol.java
        │               │   │   ├── NettyEvent.java
        │               │   │   ├── NettyEventType.java
        │               │   │   ├── ServiceThread.java
        │               │   │   ├── exception/
        │               │   │   │   └── ConnectFailedException.java
        │               │   │   └── package-info.java
        │               │   ├── example/
        │               │   │   ├── ClientConnectorStartup.java
        │               │   │   ├── SrvAcceptorStartup.java
        │               │   │   └── package-info.java
        │               │   ├── serializer/
        │               │   │   ├── Serializer.java
        │               │   │   ├── SerializerHolder.java
        │               │   │   └── protostuff/
        │               │   │       └── ProtoStuffSerializer.java
        │               │   └── srv/
        │               │       └── acceptor/
        │               │           ├── AcceptorIdleStateTrigger.java
        │               │           ├── AcknowledgeEncoder.java
        │               │           ├── ChannelEventListener.java
        │               │           ├── DefaultCommonSrvAcceptor.java
        │               │           ├── DefaultSrvAcceptor.java
        │               │           ├── NettySrvAcceptor.java
        │               │           ├── SrvAcceptor.java
        │               │           └── package-info.java
        │               └── stickpackage/
        │                   ├── correct/
        │                   │   ├── BaseClient.java
        │                   │   ├── BaseClientHandler.java
        │                   │   ├── BaseServer.java
        │                   │   └── BaseServerHandler.java
        │                   ├── delimiter/
        │                   │   ├── BaseClient.java
        │                   │   ├── BaseClientHandler.java
        │                   │   ├── BaseServer.java
        │                   │   └── BaseServerHandler.java
        │                   ├── error/
        │                   │   ├── BaseClient.java
        │                   │   ├── BaseClientHandler.java
        │                   │   ├── BaseServer.java
        │                   │   └── BaseServerHandler.java
        │                   └── myself/
        │                       ├── BaseClient.java
        │                       ├── BaseClientHandler.java
        │                       ├── BaseServer.java
        │                       └── BaseServerHandler.java
        └── resources/
            └── logback.xml
Download .txt
SYMBOL INDEX (949 symbols across 138 files)

FILE: src/main/java/com/lyncc/netty/attributeMap/AttributeMapConstant.java
  class AttributeMapConstant (line 5) | public class AttributeMapConstant {

FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorld2ClientHandler.java
  class HelloWorld2ClientHandler (line 10) | public class HelloWorld2ClientHandler extends ChannelInboundHandlerAdapt...
    method channelActive (line 14) | @Override
    method main (line 40) | public static void main(String[] args) {
    class Student (line 49) | static class Student {
      method getId (line 52) | public String getId() {
      method setId (line 55) | public void setId(String id) {
      method getAge (line 58) | public int getAge() {
      method setAge (line 61) | public void setAge(int age) {
      method Student (line 64) | public Student(String id, int age) {
    method channelRead (line 72) | @Override
    method exceptionCaught (line 86) | @Override

FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldClient.java
  class HelloWorldClient (line 15) | public class HelloWorldClient {
    method main (line 21) | public static void main(String[] args) throws Exception {
    method initChannel (line 25) | public static void initChannel() throws InterruptedException{

FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldClientHandler.java
  class HelloWorldClientHandler (line 9) | public class HelloWorldClientHandler extends ChannelInboundHandlerAdapter {
    method channelActive (line 12) | @Override
    method channelRead (line 27) | @Override
    method exceptionCaught (line 43) | @Override

FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldServer.java
  class HelloWorldServer (line 16) | public class HelloWorldServer {
    method HelloWorldServer (line 20) | public HelloWorldServer(int port) {
    method start (line 24) | public void start(){
    method main (line 50) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/attributeMap/HelloWorldServerHandler.java
  class HelloWorldServerHandler (line 6) | public class HelloWorldServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 9) | @Override
    method exceptionCaught (line 17) | @Override

FILE: src/main/java/com/lyncc/netty/attributeMap/NettyChannel.java
  class NettyChannel (line 5) | public class NettyChannel {
    method NettyChannel (line 13) | public NettyChannel(String name,Date createDate) {
    method getName (line 18) | public String getName() {
    method setName (line 23) | public void setName(String name) {
    method getCreateDate (line 28) | public Date getCreateDate() {
    method setCreateDate (line 32) | public void setCreateDate(Date createDate) {

FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolDecoder.java
  class ProtocolDecoder (line 4) | public class ProtocolDecoder{

FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolEncoder.java
  class ProtocolEncoder (line 9) | public class ProtocolEncoder extends MessageToByteEncoder<ProtocolMsg> {
    method encode (line 11) | @Override

FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolHeader.java
  class ProtocolHeader (line 3) | public class ProtocolHeader {
    method ProtocolHeader (line 15) | public ProtocolHeader() {
    method getMagic (line 19) | public byte getMagic() {
    method setMagic (line 23) | public void setMagic(byte magic) {
    method getMsgType (line 27) | public byte getMsgType() {
    method setMsgType (line 31) | public void setMsgType(byte msgType) {
    method getReserve (line 35) | public short getReserve() {
    method setReserve (line 39) | public void setReserve(short reserve) {
    method getSn (line 43) | public short getSn() {
    method setSn (line 47) | public void setSn(short sn) {
    method getLen (line 51) | public int getLen() {
    method setLen (line 55) | public void setLen(int len) {
    method ProtocolHeader (line 59) | public ProtocolHeader(byte magic, byte msgType, short reserve, short s...

FILE: src/main/java/com/lyncc/netty/codec/custom/ProtocolMsg.java
  class ProtocolMsg (line 3) | public class ProtocolMsg {
    method ProtocolMsg (line 9) | public ProtocolMsg() {
    method getProtocolHeader (line 13) | public ProtocolHeader getProtocolHeader() {
    method setProtocolHeader (line 17) | public void setProtocolHeader(ProtocolHeader protocolHeader) {
    method getBody (line 21) | public String getBody() {
    method setBody (line 25) | public void setBody(String body) {

FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonClient.java
  class JacksonClient (line 13) | public class JacksonClient {
    method JacksonClient (line 18) | public JacksonClient(String host, int port){
    method main (line 23) | public static void main(String[] args) throws Exception{
    method run (line 27) | public void run() throws Exception{

FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonClientHandler.java
  class JacksonClientHandler (line 6) | public class JacksonClientHandler extends SimpleChannelInboundHandler<Ob...
    method channelRead0 (line 8) | @Override

FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonClientHandlerInitializer.java
  class JacksonClientHandlerInitializer (line 7) | public class JacksonClientHandlerInitializer extends ChannelInitializer<...
    method initChannel (line 9) | @Override

FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonServer.java
  class JacksonServer (line 12) | public class JacksonServer {
    method main (line 16) | public static void main(String[] args) {

FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonServerHandler.java
  class JacksonServerHandler (line 7) | public class JacksonServerHandler extends SimpleChannelInboundHandler<Ob...
    method channelRead0 (line 9) | @Override
    method exceptionCaught (line 25) | @Override

FILE: src/main/java/com/lyncc/netty/codec/jackson/JacksonServerHandlerInitializer.java
  class JacksonServerHandlerInitializer (line 7) | public class JacksonServerHandlerInitializer extends ChannelInitializer<...
    method initChannel (line 9) | @Override

FILE: src/main/java/com/lyncc/netty/codec/jackson/User.java
  class User (line 5) | public class User {
    method getId (line 15) | public Integer getId() {
    method setId (line 19) | public void setId(Integer id) {
    method getName (line 23) | public String getName() {
    method setName (line 27) | public void setName(String name) {
    method getAge (line 31) | public Integer getAge() {
    method setAge (line 35) | public void setAge(Integer age) {
    method getFriends (line 39) | public List<String> getFriends() {
    method setFriends (line 43) | public void setFriends(List<String> friends) {

FILE: src/main/java/com/lyncc/netty/codec/jackson/UserDecoder.java
  class UserDecoder (line 10) | public class UserDecoder<T> extends ByteToMessageDecoder {
    method UserDecoder (line 15) | public UserDecoder(Class<T> clazz) {
    method decode (line 19) | @Override

FILE: src/main/java/com/lyncc/netty/codec/jackson/UserEncoder.java
  class UserEncoder (line 8) | public class UserEncoder extends MessageToByteEncoder<Object>{
    method encode (line 10) | @Override

FILE: src/main/java/com/lyncc/netty/codec/jackson/UserMapper.java
  class UserMapper (line 5) | public class UserMapper {
    method getInstance (line 9) | public static ObjectMapper getInstance() {

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomClient.java
  class CustomClient (line 12) | public class CustomClient {
    method main (line 18) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomClientHandler.java
  class CustomClientHandler (line 6) | public class CustomClientHandler extends ChannelInboundHandlerAdapter {
    method channelActive (line 8) | @Override

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomDecoder.java
  class CustomDecoder (line 7) | public class CustomDecoder extends LengthFieldBasedFrameDecoder {
    method CustomDecoder (line 29) | public CustomDecoder(int maxFrameLength, int lengthFieldOffset, int le...
    method decode (line 35) | @Override

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomEncoder.java
  class CustomEncoder (line 9) | public class CustomEncoder extends MessageToByteEncoder<CustomMsg> {
    method encode (line 11) | @Override

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomMsg.java
  class CustomMsg (line 3) | public class CustomMsg {
    method CustomMsg (line 17) | public CustomMsg() {
    method CustomMsg (line 21) | public CustomMsg(byte type, byte flag, int length, String body) {
    method getType (line 28) | public byte getType() {
    method setType (line 32) | public void setType(byte type) {
    method getFlag (line 36) | public byte getFlag() {
    method setFlag (line 40) | public void setFlag(byte flag) {
    method getLength (line 44) | public int getLength() {
    method setLength (line 48) | public void setLength(int length) {
    method getBody (line 52) | public String getBody() {
    method setBody (line 56) | public void setBody(String body) {

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomServer.java
  class CustomServer (line 14) | public class CustomServer {
    method CustomServer (line 24) | public CustomServer(int port) {
    method start (line 28) | public void start(){
    method main (line 53) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomServerHandler.java
  class CustomServerHandler (line 6) | public class CustomServerHandler extends SimpleChannelInboundHandler<Obj...
    method channelRead0 (line 8) | @Override

FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqClient.java
  class SubReqClient (line 36) | public class SubReqClient {
    method connect (line 38) | public void connect(int port, String host) throws Exception {
    method main (line 70) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqClientHandler.java
  class SubReqClientHandler (line 29) | public class SubReqClientHandler extends ChannelInboundHandlerAdapter {
    method SubReqClientHandler (line 34) | public SubReqClientHandler() {
    method channelActive (line 37) | @Override
    method subReq (line 45) | private SubscribeReqProto.SubscribeReq subReq(int i) {
    method channelRead (line 58) | @Override
    method channelReadComplete (line 63) | @Override
    method exceptionCaught (line 68) | @Override

FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqServer.java
  class SubReqServer (line 18) | public class SubReqServer {
    method bind (line 20) | public void bind(int port) throws Exception {
    method main (line 51) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubReqServerHandler.java
  class SubReqServerHandler (line 22) | @Sharable
    method channelRead (line 26) | @Override
    method resp (line 35) | private SubscribeRespProto.SubscribeResp resp(int subReqID) {
    method exceptionCaught (line 43) | @Override

FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubscribeReqProto.java
  class SubscribeReqProto (line 6) | public final class SubscribeReqProto {
    method SubscribeReqProto (line 7) | private SubscribeReqProto() {
    method registerAllExtensions (line 10) | public static void registerAllExtensions(com.google.protobuf.Extension...
    type SubscribeReqOrBuilder (line 13) | public interface SubscribeReqOrBuilder extends
      method hasSubReqID (line 20) | boolean hasSubReqID();
      method getSubReqID (line 25) | int getSubReqID();
      method hasUserName (line 30) | boolean hasUserName();
      method getUserName (line 35) | java.lang.String getUserName();
      method getUserNameBytes (line 40) | com.google.protobuf.ByteString getUserNameBytes();
      method hasProductName (line 45) | boolean hasProductName();
      method getProductName (line 50) | java.lang.String getProductName();
      method getProductNameBytes (line 55) | com.google.protobuf.ByteString getProductNameBytes();
      method getAddressList (line 60) | com.google.protobuf.ProtocolStringList getAddressList();
      method getAddressCount (line 65) | int getAddressCount();
      method getAddress (line 70) | java.lang.String getAddress(int index);
      method getAddressBytes (line 75) | com.google.protobuf.ByteString getAddressBytes(int index);
    class SubscribeReq (line 81) | public static final class SubscribeReq extends com.google.protobuf.Gen...
      method SubscribeReq (line 85) | private SubscribeReq(com.google.protobuf.GeneratedMessage.Builder<?>...
      method SubscribeReq (line 90) | private SubscribeReq(boolean noInit) {
      method getDefaultInstance (line 96) | public static SubscribeReq getDefaultInstance() {
      method getDefaultInstanceForType (line 100) | public SubscribeReq getDefaultInstanceForType() {
      method getUnknownFields (line 106) | @java.lang.Override
      method SubscribeReq (line 111) | private SubscribeReq(com.google.protobuf.CodedInputStream input,
      method getDescriptor (line 173) | public static final com.google.protobuf.Descriptors.Descriptor getDe...
      method internalGetFieldAccessorTable (line 177) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable in...
      method parsePartialFrom (line 185) | public SubscribeReq parsePartialFrom(com.google.protobuf.CodedInputS...
      method getParserForType (line 192) | @java.lang.Override
      method hasSubReqID (line 206) | public boolean hasSubReqID() {
      method getSubReqID (line 213) | public int getSubReqID() {
      method hasUserName (line 224) | public boolean hasUserName() {
      method getUserName (line 231) | public java.lang.String getUserName() {
      method getUserNameBytes (line 248) | public com.google.protobuf.ByteString getUserNameBytes() {
      method hasProductName (line 266) | public boolean hasProductName() {
      method getProductName (line 273) | public java.lang.String getProductName() {
      method getProductNameBytes (line 290) | public com.google.protobuf.ByteString getProductNameBytes() {
      method getAddressList (line 308) | public com.google.protobuf.ProtocolStringList getAddressList() {
      method getAddressCount (line 315) | public int getAddressCount() {
      method getAddress (line 322) | public java.lang.String getAddress(int index) {
      method getAddressBytes (line 329) | public com.google.protobuf.ByteString getAddressBytes(int index) {
      method initFields (line 333) | private void initFields() {
      method isInitialized (line 342) | public final boolean isInitialized() {
      method writeTo (line 365) | public void writeTo(com.google.protobuf.CodedOutputStream output) th...
      method getSerializedSize (line 384) | public int getSerializedSize() {
      method writeReplace (line 414) | @java.lang.Override
      method parseFrom (line 419) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 424) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 430) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 435) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 441) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 446) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseDelimitedFrom (line 452) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseDelimitedFrom (line 457) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 463) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method parseFrom (line 468) | public static com.lyncc.netty.codec.protobuf.SubscribeReqProto.Subsc...
      method newBuilder (line 474) | public static Builder newBuilder() {
      method newBuilderForType (line 478) | public Builder newBuilderForType() {
      method newBuilder (line 482) | public static Builder newBuilder(com.lyncc.netty.codec.protobuf.Subs...
      method toBuilder (line 486) | public Builder toBuilder() {
      method newBuilderForType (line 490) | @java.lang.Override
      class Builder (line 499) | public static final class Builder extends com.google.protobuf.Genera...
        method getDescriptor (line 502) | public static final com.google.protobuf.Descriptors.Descriptor get...
        method internalGetFieldAccessorTable (line 506) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable ...
        method Builder (line 515) | private Builder() {
        method Builder (line 519) | private Builder(com.google.protobuf.GeneratedMessage.BuilderParent...
        method maybeForceBuilderInitialization (line 524) | private void maybeForceBuilderInitialization() {
        method create (line 529) | private static Builder create() {
        method clear (line 533) | public Builder clear() {
        method clone (line 546) | public Builder clone() {
        method getDescriptorForType (line 550) | public com.google.protobuf.Descriptors.Descriptor getDescriptorFor...
        method getDefaultInstanceForType (line 554) | public com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeR...
        method build (line 558) | public com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeR...
        method buildPartial (line 566) | public com.lyncc.netty.codec.protobuf.SubscribeReqProto.SubscribeR...
        method mergeFrom (line 593) | public Builder mergeFrom(com.google.protobuf.Message other) {
        method mergeFrom (line 602) | public Builder mergeFrom(com.lyncc.netty.codec.protobuf.SubscribeR...
        method isInitialized (line 632) | public final boolean isInitialized() {
        method mergeFrom (line 648) | public Builder mergeFrom(com.google.protobuf.CodedInputStream input,
        method hasSubReqID (line 672) | public boolean hasSubReqID() {
        method getSubReqID (line 679) | public int getSubReqID() {
        method setSubReqID (line 686) | public Builder setSubReqID(int value) {
        method clearSubReqID (line 696) | public Builder clearSubReqID() {
        method hasUserName (line 708) | public boolean hasUserName() {
        method getUserName (line 715) | public java.lang.String getUserName() {
        method getUserNameBytes (line 732) | public com.google.protobuf.ByteString getUserNameBytes() {
        method setUserName (line 747) | public Builder setUserName(java.lang.String value) {
        method clearUserName (line 760) | public Builder clearUserName() {
        method setUserNameBytes (line 770) | public Builder setUserNameBytes(com.google.protobuf.ByteString val...
        method hasProductName (line 785) | public boolean hasProductName() {
        method getProductName (line 792) | public java.lang.String getProductName() {
        method getProductNameBytes (line 809) | public com.google.protobuf.ByteString getProductNameBytes() {
        method setProductName (line 824) | public Builder setProductName(java.lang.String value) {
        method clearProductName (line 837) | public Builder clearProductName() {
        method setProductNameBytes (line 847) | public Builder setProductNameBytes(com.google.protobuf.ByteString ...
        method ensureAddressIsMutable (line 859) | private void ensureAddressIsMutable() {
        method getAddressList (line 869) | public com.google.protobuf.ProtocolStringList getAddressList() {
        method getAddressCount (line 876) | public int getAddressCount() {
        method getAddress (line 883) | public java.lang.String getAddress(int index) {
        method getAddressBytes (line 890) | public com.google.protobuf.ByteString getAddressBytes(int index) {
        method setAddress (line 897) | public Builder setAddress(int index, java.lang.String value) {
        method addAddress (line 910) | public Builder addAddress(java.lang.String value) {
        method addAllAddress (line 923) | public Builder addAllAddress(java.lang.Iterable<java.lang.String> ...
        method clearAddress (line 933) | public Builder clearAddress() {
        method addAddressBytes (line 943) | public Builder addAddressBytes(com.google.protobuf.ByteString valu...
    method getDescriptor (line 968) | public static com.google.protobuf.Descriptors.FileDescriptor getDescri...
    method assignDescriptors (line 979) | public com.google.protobuf.ExtensionRegistry assignDescriptors(

FILE: src/main/java/com/lyncc/netty/codec/protobuf/SubscribeRespProto.java
  class SubscribeRespProto (line 6) | public final class SubscribeRespProto {
    method SubscribeRespProto (line 7) | private SubscribeRespProto() {}
    method registerAllExtensions (line 8) | public static void registerAllExtensions(
    type SubscribeRespOrBuilder (line 11) | public interface SubscribeRespOrBuilder extends
      method hasSubReqID (line 18) | boolean hasSubReqID();
      method getSubReqID (line 22) | int getSubReqID();
      method hasRespCode (line 27) | boolean hasRespCode();
      method getRespCode (line 31) | int getRespCode();
      method hasDesc (line 36) | boolean hasDesc();
      method getDesc (line 40) | java.lang.String getDesc();
      method getDescBytes (line 44) | com.google.protobuf.ByteString
    class SubscribeResp (line 50) | public static final class SubscribeResp extends
      method SubscribeResp (line 55) | private SubscribeResp(com.google.protobuf.GeneratedMessage.Builder<?...
      method SubscribeResp (line 59) | private SubscribeResp(boolean noInit) { this.unknownFields = com.goo...
      method getDefaultInstance (line 62) | public static SubscribeResp getDefaultInstance() {
      method getDefaultInstanceForType (line 66) | public SubscribeResp getDefaultInstanceForType() {
      method getUnknownFields (line 71) | @java.lang.Override
      method SubscribeResp (line 76) | private SubscribeResp(
      method getDescriptor (line 127) | public static final com.google.protobuf.Descriptors.Descriptor
      method internalGetFieldAccessorTable (line 132) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      method parsePartialFrom (line 141) | public SubscribeResp parsePartialFrom(
      method getParserForType (line 149) | @java.lang.Override
      method hasSubReqID (line 160) | public boolean hasSubReqID() {
      method getSubReqID (line 166) | public int getSubReqID() {
      method hasRespCode (line 175) | public boolean hasRespCode() {
      method getRespCode (line 181) | public int getRespCode() {
      method hasDesc (line 190) | public boolean hasDesc() {
      method getDesc (line 196) | public java.lang.String getDesc() {
      method getDescBytes (line 213) | public com.google.protobuf.ByteString
      method initFields (line 227) | private void initFields() {
      method isInitialized (line 233) | public final boolean isInitialized() {
      method writeTo (line 254) | public void writeTo(com.google.protobuf.CodedOutputStream output)
      method getSerializedSize (line 270) | public int getSerializedSize() {
      method writeReplace (line 293) | @java.lang.Override
      method parseFrom (line 299) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 304) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 310) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 314) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 320) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 324) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseDelimitedFrom (line 330) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseDelimitedFrom (line 334) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 340) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method parseFrom (line 345) | public static com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subs...
      method newBuilder (line 352) | public static Builder newBuilder() { return Builder.create(); }
      method newBuilderForType (line 353) | public Builder newBuilderForType() { return newBuilder(); }
      method newBuilder (line 354) | public static Builder newBuilder(com.lyncc.netty.codec.protobuf.Subs...
      method toBuilder (line 357) | public Builder toBuilder() { return newBuilder(this); }
      method newBuilderForType (line 359) | @java.lang.Override
      class Builder (line 368) | public static final class Builder extends
        method getDescriptor (line 372) | public static final com.google.protobuf.Descriptors.Descriptor
        method internalGetFieldAccessorTable (line 377) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        method Builder (line 385) | private Builder() {
        method Builder (line 389) | private Builder(
        method maybeForceBuilderInitialization (line 394) | private void maybeForceBuilderInitialization() {
        method create (line 398) | private static Builder create() {
        method clear (line 402) | public Builder clear() {
        method clone (line 413) | public Builder clone() {
        method getDescriptorForType (line 417) | public com.google.protobuf.Descriptors.Descriptor
        method getDefaultInstanceForType (line 422) | public com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subscribe...
        method build (line 426) | public com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subscribe...
        method buildPartial (line 434) | public com.lyncc.netty.codec.protobuf.SubscribeRespProto.Subscribe...
        method mergeFrom (line 455) | public Builder mergeFrom(com.google.protobuf.Message other) {
        method mergeFrom (line 464) | public Builder mergeFrom(com.lyncc.netty.codec.protobuf.SubscribeR...
        method isInitialized (line 481) | public final boolean isInitialized() {
        method mergeFrom (line 497) | public Builder mergeFrom(
        method hasSubReqID (line 520) | public boolean hasSubReqID() {
        method getSubReqID (line 526) | public int getSubReqID() {
        method setSubReqID (line 532) | public Builder setSubReqID(int value) {
        method clearSubReqID (line 541) | public Builder clearSubReqID() {
        method hasRespCode (line 552) | public boolean hasRespCode() {
        method getRespCode (line 558) | public int getRespCode() {
        method setRespCode (line 564) | public Builder setRespCode(int value) {
        method clearRespCode (line 573) | public Builder clearRespCode() {
        method hasDesc (line 584) | public boolean hasDesc() {
        method getDesc (line 590) | public java.lang.String getDesc() {
        method getDescBytes (line 607) | public com.google.protobuf.ByteString
        method setDesc (line 623) | public Builder setDesc(
        method clearDesc (line 636) | public Builder clearDesc() {
        method setDescBytes (line 645) | public Builder setDescBytes(
    method getDescriptor (line 673) | public static com.google.protobuf.Descriptors.FileDescriptor
    method assignDescriptors (line 688) | public com.google.protobuf.ExtensionRegistry assignDescriptors(

FILE: src/main/java/com/lyncc/netty/codec/protobuf/TestSubscribeReqProto.java
  class TestSubscribeReqProto (line 8) | public class TestSubscribeReqProto {
    method encode (line 10) | private static byte[] encode(SubscribeReqProto.SubscribeReq req) {
    method decode (line 14) | private static SubscribeReqProto.SubscribeReq decode(byte[] body) thro...
    method createSubscribeReq (line 18) | private static SubscribeReqProto.SubscribeReq createSubscribeReq() {
    method main (line 35) | public static void main(String[] args) throws InvalidProtocolBufferExc...

FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufClient.java
  class ProtoBufClient (line 14) | public class ProtoBufClient {
    method connect (line 16) | public void connect(int port, String host) throws Exception {
    method main (line 42) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufClientHandler.java
  class ProtoBufClientHandler (line 12) | public class ProtoBufClientHandler extends ChannelInboundHandlerAdapter {
    method channelActive (line 14) | @Override
    method exceptionCaught (line 36) | @Override

FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufServer.java
  class ProtoBufServer (line 16) | public class ProtoBufServer {
    method bind (line 18) | public void bind(int port) throws Exception {
    method main (line 47) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufServerHandler.java
  class ProtoBufServerHandler (line 10) | public class ProtoBufServerHandler extends ChannelInboundHandlerAdapter {
    method channelRead (line 12) | @Override
    method exceptionCaught (line 26) | @Override

FILE: src/main/java/com/lyncc/netty/codec/protobuf/demo/RichManProto.java
  class RichManProto (line 6) | public final class RichManProto {
    method RichManProto (line 7) | private RichManProto() {
    method registerAllExtensions (line 10) | public static void registerAllExtensions(com.google.protobuf.Extension...
    type RichManOrBuilder (line 13) | public interface RichManOrBuilder extends
      method hasId (line 20) | boolean hasId();
      method getId (line 25) | int getId();
      method hasName (line 30) | boolean hasName();
      method getName (line 35) | java.lang.String getName();
      method getNameBytes (line 40) | com.google.protobuf.ByteString getNameBytes();
      method hasEmail (line 45) | boolean hasEmail();
      method getEmail (line 50) | java.lang.String getEmail();
      method getEmailBytes (line 55) | com.google.protobuf.ByteString getEmailBytes();
      method getCarsList (line 60) | java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManProto.Rich...
      method getCars (line 65) | com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car getCars...
      method getCarsCount (line 70) | int getCarsCount();
      method getCarsOrBuilderList (line 75) | java.util.List<? extends com.lyncc.netty.codec.protobuf.demo.RichMan...
      method getCarsOrBuilder (line 80) | com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarOrBuilde...
    class RichMan (line 86) | public static final class RichMan extends com.google.protobuf.Generate...
      method RichMan (line 90) | private RichMan(com.google.protobuf.GeneratedMessage.Builder<?> buil...
      method RichMan (line 95) | private RichMan(boolean noInit) {
      method getDefaultInstance (line 101) | public static RichMan getDefaultInstance() {
      method getDefaultInstanceForType (line 105) | public RichMan getDefaultInstanceForType() {
      method getUnknownFields (line 111) | @java.lang.Override
      method RichMan (line 116) | private RichMan(com.google.protobuf.CodedInputStream input,
      method getDescriptor (line 178) | public static final com.google.protobuf.Descriptors.Descriptor getDe...
      method internalGetFieldAccessorTable (line 182) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable in...
      method parsePartialFrom (line 189) | public RichMan parsePartialFrom(com.google.protobuf.CodedInputStream...
      method getParserForType (line 196) | @java.lang.Override
      type CarType (line 204) | public enum CarType implements com.google.protobuf.ProtocolMessageEn...
        method getNumber (line 242) | public final int getNumber() {
        method valueOf (line 246) | public static CarType valueOf(int value) {
        method internalGetValueMap (line 261) | public static com.google.protobuf.Internal.EnumLiteMap<CarType> in...
        method findValueByNumber (line 266) | public CarType findValueByNumber(int number) {
        method getValueDescriptor (line 271) | public final com.google.protobuf.Descriptors.EnumValueDescriptor g...
        method getDescriptorForType (line 275) | public final com.google.protobuf.Descriptors.EnumDescriptor getDes...
        method getDescriptor (line 279) | public static final com.google.protobuf.Descriptors.EnumDescriptor...
        method valueOf (line 285) | public static CarType valueOf(com.google.protobuf.Descriptors.Enum...
        method CarType (line 296) | private CarType(int index, int value) {
      type CarOrBuilder (line 304) | public interface CarOrBuilder extends
        method hasName (line 311) | boolean hasName();
        method getName (line 316) | java.lang.String getName();
        method getNameBytes (line 321) | com.google.protobuf.ByteString getNameBytes();
        method hasType (line 326) | boolean hasType();
        method getType (line 331) | com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarType g...
      class Car (line 337) | public static final class Car extends com.google.protobuf.GeneratedM...
        method Car (line 341) | private Car(com.google.protobuf.GeneratedMessage.Builder<?> builde...
        method Car (line 346) | private Car(boolean noInit) {
        method getDefaultInstance (line 352) | public static Car getDefaultInstance() {
        method getDefaultInstanceForType (line 356) | public Car getDefaultInstanceForType() {
        method getUnknownFields (line 362) | @java.lang.Override
        method Car (line 367) | private Car(com.google.protobuf.CodedInputStream input,
        method getDescriptor (line 419) | public static final com.google.protobuf.Descriptors.Descriptor get...
        method internalGetFieldAccessorTable (line 423) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable ...
        method parsePartialFrom (line 431) | public Car parsePartialFrom(com.google.protobuf.CodedInputStream i...
        method getParserForType (line 438) | @java.lang.Override
        method hasName (line 452) | public boolean hasName() {
        method getName (line 459) | public java.lang.String getName() {
        method getNameBytes (line 476) | public com.google.protobuf.ByteString getNameBytes() {
        method hasType (line 495) | public boolean hasType() {
        method getType (line 502) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Ca...
        method initFields (line 506) | private void initFields() {
        method isInitialized (line 513) | public final boolean isInitialized() {
        method writeTo (line 528) | public void writeTo(com.google.protobuf.CodedOutputStream output) ...
        method getSerializedSize (line 541) | public int getSerializedSize() {
        method writeReplace (line 560) | @java.lang.Override
        method parseFrom (line 565) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 570) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 576) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 581) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 587) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 592) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseDelimitedFrom (line 598) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseDelimitedFrom (line 603) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 609) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method parseFrom (line 614) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.Ric...
        method newBuilder (line 620) | public static Builder newBuilder() {
        method newBuilderForType (line 624) | public Builder newBuilderForType() {
        method newBuilder (line 628) | public static Builder newBuilder(com.lyncc.netty.codec.protobuf.de...
        method toBuilder (line 632) | public Builder toBuilder() {
        method newBuilderForType (line 636) | @java.lang.Override
        class Builder (line 645) | public static final class Builder extends com.google.protobuf.Gene...
          method getDescriptor (line 648) | public static final com.google.protobuf.Descriptors.Descriptor g...
          method internalGetFieldAccessorTable (line 652) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTabl...
          method Builder (line 661) | private Builder() {
          method Builder (line 665) | private Builder(com.google.protobuf.GeneratedMessage.BuilderPare...
          method maybeForceBuilderInitialization (line 670) | private void maybeForceBuilderInitialization() {
          method create (line 675) | private static Builder create() {
          method clear (line 679) | public Builder clear() {
          method clone (line 688) | public Builder clone() {
          method getDescriptorForType (line 692) | public com.google.protobuf.Descriptors.Descriptor getDescriptorF...
          method getDefaultInstanceForType (line 696) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan....
          method build (line 700) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan....
          method buildPartial (line 708) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan....
          method mergeFrom (line 726) | public Builder mergeFrom(com.google.protobuf.Message other) {
          method mergeFrom (line 735) | public Builder mergeFrom(com.lyncc.netty.codec.protobuf.demo.Ric...
          method isInitialized (line 750) | public final boolean isInitialized() {
          method mergeFrom (line 758) | public Builder mergeFrom(com.google.protobuf.CodedInputStream in...
          method hasName (line 782) | public boolean hasName() {
          method getName (line 789) | public java.lang.String getName() {
          method getNameBytes (line 806) | public com.google.protobuf.ByteString getNameBytes() {
          method setName (line 821) | public Builder setName(java.lang.String value) {
          method clearName (line 834) | public Builder clearName() {
          method setNameBytes (line 844) | public Builder setNameBytes(com.google.protobuf.ByteString value) {
          method hasType (line 859) | public boolean hasType() {
          method getType (line 866) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan....
          method setType (line 873) | public Builder setType(com.lyncc.netty.codec.protobuf.demo.RichM...
          method clearType (line 886) | public Builder clearType() {
      method hasId (line 913) | public boolean hasId() {
      method getId (line 920) | public int getId() {
      method hasName (line 931) | public boolean hasName() {
      method getName (line 938) | public java.lang.String getName() {
      method getNameBytes (line 955) | public com.google.protobuf.ByteString getNameBytes() {
      method hasEmail (line 973) | public boolean hasEmail() {
      method getEmail (line 980) | public java.lang.String getEmail() {
      method getEmailBytes (line 997) | public com.google.protobuf.ByteString getEmailBytes() {
      method getCarsList (line 1015) | public java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManPro...
      method getCarsOrBuilderList (line 1022) | public java.util.List<? extends com.lyncc.netty.codec.protobuf.demo....
      method getCarsCount (line 1029) | public int getCarsCount() {
      method getCars (line 1036) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Car ...
      method getCarsOrBuilder (line 1043) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.CarO...
      method initFields (line 1047) | private void initFields() {
      method isInitialized (line 1056) | public final boolean isInitialized() {
      method writeTo (line 1081) | public void writeTo(com.google.protobuf.CodedOutputStream output) th...
      method getSerializedSize (line 1100) | public int getSerializedSize() {
      method writeReplace (line 1125) | @java.lang.Override
      method parseFrom (line 1130) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1135) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1141) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1146) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1152) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1157) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseDelimitedFrom (line 1162) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseDelimitedFrom (line 1167) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1173) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method parseFrom (line 1178) | public static com.lyncc.netty.codec.protobuf.demo.RichManProto.RichM...
      method newBuilder (line 1184) | public static Builder newBuilder() {
      method newBuilderForType (line 1188) | public Builder newBuilderForType() {
      method newBuilder (line 1192) | public static Builder newBuilder(com.lyncc.netty.codec.protobuf.demo...
      method toBuilder (line 1196) | public Builder toBuilder() {
      method newBuilderForType (line 1200) | @java.lang.Override
      class Builder (line 1209) | public static final class Builder extends com.google.protobuf.Genera...
        method getDescriptor (line 1212) | public static final com.google.protobuf.Descriptors.Descriptor get...
        method internalGetFieldAccessorTable (line 1216) | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable ...
        method Builder (line 1225) | private Builder() {
        method Builder (line 1229) | private Builder(com.google.protobuf.GeneratedMessage.BuilderParent...
        method maybeForceBuilderInitialization (line 1234) | private void maybeForceBuilderInitialization() {
        method create (line 1240) | private static Builder create() {
        method clear (line 1244) | public Builder clear() {
        method clone (line 1261) | public Builder clone() {
        method getDescriptorForType (line 1265) | public com.google.protobuf.Descriptors.Descriptor getDescriptorFor...
        method getDefaultInstanceForType (line 1269) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan ge...
        method build (line 1273) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan bu...
        method buildPartial (line 1281) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan bu...
        method mergeFrom (line 1312) | public Builder mergeFrom(com.google.protobuf.Message other) {
        method mergeFrom (line 1321) | public Builder mergeFrom(com.lyncc.netty.codec.protobuf.demo.RichM...
        method isInitialized (line 1366) | public final boolean isInitialized() {
        method mergeFrom (line 1384) | public Builder mergeFrom(com.google.protobuf.CodedInputStream input,
        method hasId (line 1407) | public boolean hasId() {
        method getId (line 1414) | public int getId() {
        method setId (line 1421) | public Builder setId(int value) {
        method clearId (line 1431) | public Builder clearId() {
        method hasName (line 1443) | public boolean hasName() {
        method getName (line 1450) | public java.lang.String getName() {
        method getNameBytes (line 1467) | public com.google.protobuf.ByteString getNameBytes() {
        method setName (line 1482) | public Builder setName(java.lang.String value) {
        method clearName (line 1495) | public Builder clearName() {
        method setNameBytes (line 1505) | public Builder setNameBytes(com.google.protobuf.ByteString value) {
        method hasEmail (line 1520) | public boolean hasEmail() {
        method getEmail (line 1527) | public java.lang.String getEmail() {
        method getEmailBytes (line 1544) | public com.google.protobuf.ByteString getEmailBytes() {
        method setEmail (line 1559) | public Builder setEmail(java.lang.String value) {
        method clearEmail (line 1572) | public Builder clearEmail() {
        method setEmailBytes (line 1582) | public Builder setEmailBytes(com.google.protobuf.ByteString value) {
        method ensureCarsIsMutable (line 1595) | private void ensureCarsIsMutable() {
        method getCarsList (line 1607) | public java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManP...
        method getCarsCount (line 1618) | public int getCarsCount() {
        method getCars (line 1629) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Ca...
        method setCars (line 1640) | public Builder setCars(int index, com.lyncc.netty.codec.protobuf.d...
        method setCars (line 1657) | public Builder setCars(int index,
        method addCars (line 1672) | public Builder addCars(com.lyncc.netty.codec.protobuf.demo.RichMan...
        method addCars (line 1689) | public Builder addCars(int index, com.lyncc.netty.codec.protobuf.d...
        method addCars (line 1706) | public Builder addCars(com.lyncc.netty.codec.protobuf.demo.RichMan...
        method addCars (line 1720) | public Builder addCars(int index,
        method addAllCars (line 1735) | public Builder addAllCars(
        method clearCars (line 1750) | public Builder clearCars() {
        method removeCars (line 1764) | public Builder removeCars(int index) {
        method getCarsBuilder (line 1778) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Ca...
        method getCarsOrBuilder (line 1785) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Ca...
        method getCarsOrBuilderList (line 1796) | public java.util.List<? extends com.lyncc.netty.codec.protobuf.dem...
        method addCarsBuilder (line 1807) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Ca...
        method addCarsBuilder (line 1815) | public com.lyncc.netty.codec.protobuf.demo.RichManProto.RichMan.Ca...
        method getCarsBuilderList (line 1823) | public java.util.List<com.lyncc.netty.codec.protobuf.demo.RichManP...
        method getCarsFieldBuilder (line 1827) | private com.google.protobuf.RepeatedFieldBuilder<com.lyncc.netty.c...
    method getDescriptor (line 1855) | public static com.google.protobuf.Descriptors.FileDescriptor getDescri...
    method assignDescriptors (line 1869) | public com.google.protobuf.ExtensionRegistry assignDescriptors(

FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseClient.java
  class BaseClient (line 15) | public class BaseClient {
    method main (line 21) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseClient1Handler.java
  class BaseClient1Handler (line 12) | public class BaseClient1Handler extends ChannelInboundHandlerAdapter{
    method channelActive (line 14) | @Override
    method channelInactive (line 20) | @Override

FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseClient2Handler.java
  class BaseClient2Handler (line 12) | public class BaseClient2Handler extends ChannelInboundHandlerAdapter{
    method channelActive (line 14) | @Override

FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseServer.java
  class BaseServer (line 16) | public class BaseServer {
    method BaseServer (line 20) | public BaseServer(int port) {
    method start (line 24) | public void start(){
    method main (line 51) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/component/channelhandler/BaseServerHandler.java
  class BaseServerHandler (line 8) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 11) | @Override
    method exceptionCaught (line 19) | @Override

FILE: src/main/java/com/lyncc/netty/component/simplehandler/BaseClient.java
  class BaseClient (line 15) | public class BaseClient {
    method main (line 21) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/component/simplehandler/BaseClientHandler.java
  class BaseClientHandler (line 6) | public class BaseClientHandler extends SimpleChannelInboundHandler<String>{
    method channelRead0 (line 8) | @Override
    method exceptionCaught (line 19) | @Override

FILE: src/main/java/com/lyncc/netty/component/simplehandler/BaseServer.java
  class BaseServer (line 16) | public class BaseServer {
    method BaseServer (line 20) | public BaseServer(int port) {
    method start (line 24) | public void start(){
    method main (line 51) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/component/simplehandler/BaseServerHandler.java
  class BaseServerHandler (line 8) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 11) | @Override
    method exceptionCaught (line 19) | @Override

FILE: src/main/java/com/lyncc/netty/concept/HelloWorldConcept.java
  class HelloWorldConcept (line 9) | public class HelloWorldConcept {

FILE: src/main/java/com/lyncc/netty/heartbeat/BaseClient.java
  class BaseClient (line 18) | public class BaseClient {
    method connect (line 20) | public void connect(int port, String host) throws Exception {
    method main (line 57) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/heartbeat/BaseClientHandler.java
  class BaseClientHandler (line 18) | public class BaseClientHandler extends ChannelInboundHandlerAdapter {
    method channelActive (line 27) | @Override
    method channelInactive (line 34) | @Override
    method userEventTriggered (line 39) | @Override
    method channelRead (line 54) | @Override

FILE: src/main/java/com/lyncc/netty/heartbeat/BaseServer.java
  class BaseServer (line 18) | public class BaseServer {
    method BaseServer (line 22) | public BaseServer(int port) {
    method start (line 26) | public void start(){
    method main (line 58) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/heartbeat/BaseServerHandler.java
  class BaseServerHandler (line 8) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method userEventTriggered (line 12) | @Override
    method channelRead (line 30) | @Override
    method exceptionCaught (line 37) | @Override

FILE: src/main/java/com/lyncc/netty/heartbeat2/AskMsg.java
  class AskMsg (line 3) | public class AskMsg extends BaseMsg {
    method AskMsg (line 5) | public AskMsg() {
    method getParams (line 12) | public AskParams getParams() {
    method setParams (line 16) | public void setParams(AskParams params) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/AskParams.java
  class AskParams (line 5) | public class AskParams implements Serializable{
    method getAuth (line 14) | public String getAuth() {
    method setAuth (line 18) | public void setAuth(String auth) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/BaseMsg.java
  class BaseMsg (line 5) | public abstract class BaseMsg implements Serializable {
    method BaseMsg (line 16) | public BaseMsg() {
    method getType (line 20) | public MsgType getType() {
    method setType (line 24) | public void setType(MsgType type) {
    method getClientId (line 28) | public String getClientId() {
    method setClientId (line 32) | public void setClientId(String clientId) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/Constants.java
  class Constants (line 3) | public class Constants {
    method getClientId (line 7) | public static String getClientId() {
    method setClientId (line 11) | public static void setClientId(String clientId) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/LoginMsg.java
  class LoginMsg (line 3) | public class LoginMsg extends BaseMsg {
    method LoginMsg (line 10) | public LoginMsg() {
    method getUserName (line 15) | public String getUserName() {
    method setUserName (line 19) | public void setUserName(String userName) {
    method getPassword (line 23) | public String getPassword() {
    method setPassword (line 27) | public void setPassword(String password) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/MsgType.java
  type MsgType (line 3) | public enum MsgType {

FILE: src/main/java/com/lyncc/netty/heartbeat2/NettyChannelMap.java
  class NettyChannelMap (line 9) | public class NettyChannelMap {
    method add (line 13) | public static void add(String clientId,SocketChannel socketChannel){
    method get (line 17) | public static Channel get(String clientId){
    method remove (line 21) | public static void remove(SocketChannel socketChannel){

FILE: src/main/java/com/lyncc/netty/heartbeat2/NettyClientBootstrap.java
  class NettyClientBootstrap (line 20) | public class NettyClientBootstrap {
    method NettyClientBootstrap (line 30) | public NettyClientBootstrap(int port, String host) throws InterruptedE...
    method start (line 36) | private void start() throws InterruptedException {
    method main (line 59) | public static void main(String[] args) throws InterruptedException {

FILE: src/main/java/com/lyncc/netty/heartbeat2/NettyClientHandler.java
  class NettyClientHandler (line 9) | public class NettyClientHandler extends SimpleChannelInboundHandler<Base...
    method userEventTriggered (line 11) | @Override
    method channelRead0 (line 26) | @Override
    method exceptionCaught (line 56) | @Override

FILE: src/main/java/com/lyncc/netty/heartbeat2/NettyServerBootstrap.java
  class NettyServerBootstrap (line 20) | public class NettyServerBootstrap {
    method NettyServerBootstrap (line 26) | public NettyServerBootstrap(int port) throws InterruptedException {
    method bind (line 31) | private void bind() throws InterruptedException {
    method main (line 58) | public static void main(String []args) throws InterruptedException {

FILE: src/main/java/com/lyncc/netty/heartbeat2/NettyServerHandler.java
  class NettyServerHandler (line 9) | public class NettyServerHandler extends SimpleChannelInboundHandler<Base...
    method channelInactive (line 11) | @Override
    method channelRead0 (line 16) | @Override
    method exceptionCaught (line 58) | @Override

FILE: src/main/java/com/lyncc/netty/heartbeat2/PingMsg.java
  class PingMsg (line 3) | public class PingMsg extends BaseMsg{
    method PingMsg (line 5) | public PingMsg() {

FILE: src/main/java/com/lyncc/netty/heartbeat2/ReplyBody.java
  class ReplyBody (line 5) | public class ReplyBody implements Serializable{

FILE: src/main/java/com/lyncc/netty/heartbeat2/ReplyClientBody.java
  class ReplyClientBody (line 3) | public class ReplyClientBody extends ReplyBody {
    method ReplyClientBody (line 7) | public ReplyClientBody(String clientInfo) {
    method getClientInfo (line 11) | public String getClientInfo() {
    method setClientInfo (line 15) | public void setClientInfo(String clientInfo) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/ReplyMsg.java
  class ReplyMsg (line 3) | public class ReplyMsg extends BaseMsg {
    method ReplyMsg (line 5) | public ReplyMsg() {
    method getBody (line 12) | public ReplyBody getBody() {
    method setBody (line 16) | public void setBody(ReplyBody body) {

FILE: src/main/java/com/lyncc/netty/heartbeat2/ReplyServerBody.java
  class ReplyServerBody (line 3) | public class ReplyServerBody extends ReplyBody {
    method ReplyServerBody (line 7) | public ReplyServerBody(String serverInfo) {
    method getServerInfo (line 10) | public String getServerInfo() {
    method setServerInfo (line 13) | public void setServerInfo(String serverInfo) {

FILE: src/main/java/com/lyncc/netty/heartbeats/HeartBeatClientHandler.java
  class HeartBeatClientHandler (line 14) | public class HeartBeatClientHandler extends ChannelInboundHandlerAdapter {
    method channelActive (line 24) | @Override
    method channelInactive (line 31) | @Override
    method userEventTriggered (line 37) | @Override
    method channelRead (line 52) | @Override

FILE: src/main/java/com/lyncc/netty/heartbeats/HeartBeatServer.java
  class HeartBeatServer (line 20) | public class HeartBeatServer {
    method HeartBeatServer (line 24) | public HeartBeatServer(int port) {
    method start (line 28) | public void start(){
    method main (line 54) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/heartbeats/HeartBeatServerHandler.java
  class HeartBeatServerHandler (line 8) | public class HeartBeatServerHandler extends ChannelInboundHandlerAdapter {
    method userEventTriggered (line 12) | @Override
    method channelRead (line 29) | @Override
    method exceptionCaught (line 35) | @Override

FILE: src/main/java/com/lyncc/netty/heartbeats/HeartBeatsClient.java
  class HeartBeatsClient (line 20) | public class HeartBeatsClient {
    method connect (line 22) | public void connect(int port, String host) throws Exception {
    method main (line 64) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/hello/HelloWorldClient.java
  class HelloWorldClient (line 18) | public class HelloWorldClient {
    method main (line 24) | public static void main(String[] args) throws Exception {
    method initChannel (line 28) | public static void initChannel() throws InterruptedException{

FILE: src/main/java/com/lyncc/netty/hello/HelloWorldClientHandler.java
  class HelloWorldClientHandler (line 6) | public class HelloWorldClientHandler extends ChannelInboundHandlerAdapter{
    method channelActive (line 9) | @Override
    method channelRead (line 15) | @Override
    method channelInactive (line 20) | @Override
    method exceptionCaught (line 27) | @Override

FILE: src/main/java/com/lyncc/netty/hello/HelloWorldServer.java
  class HelloWorldServer (line 16) | public class HelloWorldServer {
    method HelloWorldServer (line 20) | public HelloWorldServer(int port) {
    method start (line 24) | public void start(){
    method main (line 52) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/hello/HelloWorldServerHandler.java
  class HelloWorldServerHandler (line 6) | public class HelloWorldServerHandler extends ChannelInboundHandlerAdapter{
    method channelActive (line 9) | @Override
    method channelRead (line 15) | @Override
    method exceptionCaught (line 22) | @Override

FILE: src/main/java/com/lyncc/netty/idle/AcceptorIdleStateTrigger.java
  class AcceptorIdleStateTrigger (line 10) | @ChannelHandler.Sharable
    method userEventTriggered (line 13) | @Override

FILE: src/main/java/com/lyncc/netty/idle/ChannelHandlerHolder.java
  type ChannelHandlerHolder (line 12) | public interface ChannelHandlerHolder {
    method handlers (line 14) | ChannelHandler[] handlers();

FILE: src/main/java/com/lyncc/netty/idle/ConnectionWatchdog.java
  class ConnectionWatchdog (line 21) | @Sharable
    method ConnectionWatchdog (line 36) | public ConnectionWatchdog(Bootstrap bootstrap, Timer timer, int port,S...
    method channelActive (line 47) | @Override
    method channelInactive (line 56) | @Override
    method run (line 72) | public void run(Timeout timeout) throws Exception {

FILE: src/main/java/com/lyncc/netty/idle/ConnectorIdleStateTrigger.java
  class ConnectorIdleStateTrigger (line 12) | @Sharable
    method userEventTriggered (line 18) | @Override

FILE: src/main/java/com/lyncc/netty/idle/HeartBeatClientHandler.java
  class HeartBeatClientHandler (line 10) | @Sharable
    method channelActive (line 14) | @Override
    method channelInactive (line 21) | @Override
    method channelRead (line 28) | @Override

FILE: src/main/java/com/lyncc/netty/idle/HeartBeatServer.java
  class HeartBeatServer (line 20) | public class HeartBeatServer {
    method HeartBeatServer (line 26) | public HeartBeatServer(int port) {
    method start (line 30) | public void start() {
    method main (line 57) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/idle/HeartBeatServerHandler.java
  class HeartBeatServerHandler (line 6) | public class HeartBeatServerHandler extends ChannelInboundHandlerAdapter {
    method channelRead (line 9) | @Override
    method exceptionCaught (line 15) | @Override

FILE: src/main/java/com/lyncc/netty/idle/HeartBeatsClient.java
  class HeartBeatsClient (line 20) | public class HeartBeatsClient {
    method connect (line 28) | public void connect(int port, String host) throws Exception {
    method main (line 76) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/keepalive/Constants.java
  class Constants (line 3) | public class Constants {

FILE: src/main/java/com/lyncc/netty/keepalive/Heartbeat.java
  class Heartbeat (line 8) | public class Heartbeat extends SimpleChannelInboundHandler<KeepAliveMess...
    method channelRead0 (line 19) | @Override
    method userEventTriggered (line 40) | public void userEventTriggered(ChannelHandlerContext ctx, Object evt) ...
    method exceptionCaught (line 65) | @Override
    method channelActive (line 77) | @Override
    method channelInactive (line 83) | @Override

FILE: src/main/java/com/lyncc/netty/keepalive/KeepAliveClient.java
  class KeepAliveClient (line 24) | public class KeepAliveClient {
    method KeepAliveClient (line 52) | public KeepAliveClient(String host, int port) {
    method start (line 60) | public void start() {
    method connServer (line 64) | private void connServer(){
    class HeartbeatInitializer (line 102) | public class HeartbeatInitializer extends ChannelInitializer<SocketCha...
      method initChannel (line 104) | @Override
    class ClientHandler (line 117) | public class ClientHandler extends SimpleChannelInboundHandler<KeepAli...
      method channelRead0 (line 119) | @Override
      method channelActive (line 129) | @Override
      method channelInactive (line 135) | @Override
      method userEventTriggered (line 147) | public void userEventTriggered(ChannelHandlerContext ctx, Object evt...
    method getSrcMsg (line 170) | private KeepAliveMessage getSrcMsg(){
    method stop (line 178) | public void stop(){
    method main (line 191) | public static void main(String[] args) {

FILE: src/main/java/com/lyncc/netty/keepalive/KeepAliveMessage.java
  class KeepAliveMessage (line 3) | public class KeepAliveMessage implements java.io.Serializable{
    method getSn (line 11) | public String getSn() {
    method setSn (line 15) | public void setSn(String sn) {
    method getReqCode (line 19) | public int getReqCode() {
    method setReqCode (line 23) | public void setReqCode(int reqCode) {

FILE: src/main/java/com/lyncc/netty/keepalive/KeepAliveServer.java
  class KeepAliveServer (line 9) | public class KeepAliveServer {
    method KeepAliveServer (line 13) | public KeepAliveServer(int port) {
    method startServer (line 21) | public void startServer() {

FILE: src/main/java/com/lyncc/netty/keepalive/KeepAliveServerInitializer.java
  class KeepAliveServerInitializer (line 13) | public class KeepAliveServerInitializer extends ChannelInitializer<Socke...
    method initChannel (line 22) | @Override

FILE: src/main/java/com/lyncc/netty/keepalive/Utils.java
  class Utils (line 5) | public class Utils {
    method notEmpty (line 14) | public static boolean notEmpty(Object o) {

FILE: src/main/java/com/lyncc/netty/nio/EchoClient.java
  class EchoClient (line 12) | public class EchoClient {
    method main (line 14) | public static void main(String[] args) throws IOException {

FILE: src/main/java/com/lyncc/netty/nio/MultiPortEchoServer.java
  class MultiPortEchoServer (line 15) | public class MultiPortEchoServer {
    method main (line 23) | public static void main(String[] args) {
    method MultiPortEchoServer (line 31) | public MultiPortEchoServer(int[] ports){
    method go (line 41) | public void go() throws IOException{

FILE: src/main/java/com/lyncc/netty/production/ChannelHandlerHolder.java
  type ChannelHandlerHolder (line 27) | public interface ChannelHandlerHolder {
    method handlers (line 29) | ChannelHandler[] handlers();

FILE: src/main/java/com/lyncc/netty/production/ConnectionWatchdog.java
  class ConnectionWatchdog (line 19) | @ChannelHandler.Sharable
    method ConnectionWatchdog (line 32) | public ConnectionWatchdog(Bootstrap bootstrap, Timer timer, int port,S...
    method isReconnect (line 39) | public boolean isReconnect() {
    method setReconnect (line 43) | public void setReconnect(boolean reconnect) {
    method channelActive (line 47) | @Override
    method channelInactive (line 60) | @Override
    method run (line 76) | public void run(Timeout timeout) throws Exception {

FILE: src/main/java/com/lyncc/netty/production/client/connector/ClientConnector.java
  type ClientConnector (line 12) | public interface ClientConnector {
    method connect (line 14) | Channel connect(int port,String host);
    method shutdownGracefully (line 16) | void shutdownGracefully();

FILE: src/main/java/com/lyncc/netty/production/client/connector/ConnectorIdleStateTrigger.java
  class ConnectorIdleStateTrigger (line 20) | @ChannelHandler.Sharable
    method userEventTriggered (line 25) | @Override

FILE: src/main/java/com/lyncc/netty/production/client/connector/DefaultCommonClientConnector.java
  class DefaultCommonClientConnector (line 56) | public class DefaultCommonClientConnector extends NettyClientConnector {
    method newThread (line 76) | public Thread newThread(Runnable r) {
    method DefaultCommonClientConnector (line 84) | public DefaultCommonClientConnector() {
    method init (line 88) | @Override
    method connect (line 103) | public Channel connect(int port, String host) {
    class MessageHandler (line 148) | @ChannelHandler.Sharable
      method channelRead (line 151) | @Override
    class MessageEncoder (line 180) | @ChannelHandler.Sharable
      method encode (line 183) | @Override
    class MessageDecoder (line 196) | static class MessageDecoder extends ReplayingDecoder<MessageDecoder.St...
      method MessageDecoder (line 198) | public MessageDecoder() {
      method decode (line 205) | @Override
      method checkMagic (line 254) | private static void checkMagic(short magic) throws Exception {
      type State (line 260) | enum State {
    method initEventLoopGroup (line 270) | @Override
    class MessageNonAck (line 275) | public static class MessageNonAck {
      method MessageNonAck (line 282) | public MessageNonAck(Message msg, Channel channel) {
    class AckTimeoutScanner (line 290) | private class AckTimeoutScanner implements Runnable {
      method run (line 292) | public void run() {
    method addNeedAckMessageInfo (line 328) | public void addNeedAckMessageInfo(MessageNonAck msgNonAck) {

FILE: src/main/java/com/lyncc/netty/production/client/connector/NettyClientConnector.java
  class NettyClientConnector (line 10) | public abstract class NettyClientConnector implements ClientConnector {
    method NettyClientConnector (line 20) | public NettyClientConnector() {
    method NettyClientConnector (line 24) | public NettyClientConnector(int nWorkers) {
    method init (line 28) | protected void init() {
    method bootstrap (line 36) | protected Bootstrap bootstrap() {
    method bootstrapLock (line 40) | protected Object bootstrapLock() {
    method shutdownGracefully (line 44) | public void shutdownGracefully() {
    method initEventLoopGroup (line 48) | protected abstract EventLoopGroup initEventLoopGroup(int nWorkers, Thr...

FILE: src/main/java/com/lyncc/netty/production/common/Acknowledge.java
  class Acknowledge (line 27) | public class Acknowledge {
    method Acknowledge (line 29) | public Acknowledge() {}
    method Acknowledge (line 31) | public Acknowledge(long sequence) {
    method sequence (line 37) | public long sequence() {
    method sequence (line 41) | public void sequence(long sequence) {

FILE: src/main/java/com/lyncc/netty/production/common/Heartbeats.java
  class Heartbeats (line 16) | public class Heartbeats {
    method heartbeatContent (line 30) | public static ByteBuf heartbeatContent() {

FILE: src/main/java/com/lyncc/netty/production/common/Message.java
  class Message (line 29) | public class Message {
    method Message (line 38) | public Message() {
    method Message (line 42) | public Message(long sequence) {
    method sequence (line 46) | public long sequence() {
    method sign (line 50) | public short sign() {
    method sign (line 54) | public void sign(short sign) {
    method getVersion (line 58) | public long getVersion() {
    method setVersion (line 62) | public void setVersion(long version) {
    method data (line 66) | public Object data() {
    method data (line 70) | public void data(Object data) {
    method toString (line 74) | @Override

FILE: src/main/java/com/lyncc/netty/production/common/NativeSupport.java
  class NativeSupport (line 11) | public final class NativeSupport {
    method isSupportNativeET (line 29) | public static boolean isSupportNativeET() {

FILE: src/main/java/com/lyncc/netty/production/common/NettyCommonProtocol.java
  class NettyCommonProtocol (line 10) | public class NettyCommonProtocol {
    method sign (line 38) | public byte sign() {
    method sign (line 42) | public void sign(byte sign) {
    method status (line 46) | public byte status() {
    method status (line 50) | public void status(byte status) {
    method id (line 54) | public long id() {
    method id (line 58) | public void id(long id) {
    method bodyLength (line 62) | public int bodyLength() {
    method bodyLength (line 66) | public void bodyLength(int bodyLength) {
    method toString (line 70) | @Override

FILE: src/main/java/com/lyncc/netty/production/common/NettyEvent.java
  class NettyEvent (line 27) | public class NettyEvent {
    method NettyEvent (line 33) | public NettyEvent(NettyEventType type, String remoteAddr, Channel chan...
    method getType (line 40) | public NettyEventType getType() {
    method getRemoteAddr (line 45) | public String getRemoteAddr() {
    method getChannel (line 50) | public Channel getChannel() {
    method toString (line 55) | @Override

FILE: src/main/java/com/lyncc/netty/production/common/NettyEventType.java
  type NettyEventType (line 24) | public enum NettyEventType {

FILE: src/main/java/com/lyncc/netty/production/common/ServiceThread.java
  class ServiceThread (line 7) | public abstract class ServiceThread implements Runnable {
    method ServiceThread (line 15) | public ServiceThread() {
    method getServiceName (line 20) | public abstract String getServiceName();
    method start (line 23) | public void start() {
    method shutdown (line 28) | public void shutdown() {
    method stop (line 33) | public void stop() {
    method makeStop (line 38) | public void makeStop() {
    method stop (line 44) | public void stop(final boolean interrupt) {
    method shutdown (line 60) | public void shutdown(final boolean interrupt) {
    method wakeup (line 86) | public void wakeup() {
    method waitForRunning (line 96) | protected void waitForRunning(long interval) {
    method onWaitEnd (line 116) | protected void onWaitEnd() {
    method isStoped (line 120) | public boolean isStoped() {
    method getJointime (line 125) | public long getJointime() {

FILE: src/main/java/com/lyncc/netty/production/common/exception/ConnectFailedException.java
  class ConnectFailedException (line 25) | public class ConnectFailedException extends RuntimeException {
    method ConnectFailedException (line 29) | public ConnectFailedException() {
    method ConnectFailedException (line 33) | public ConnectFailedException(String message) {
    method ConnectFailedException (line 37) | public ConnectFailedException(String message, Throwable cause) {
    method ConnectFailedException (line 41) | public ConnectFailedException(Throwable cause) {

FILE: src/main/java/com/lyncc/netty/production/example/ClientConnectorStartup.java
  class ClientConnectorStartup (line 23) | public class ClientConnectorStartup {
    method main (line 27) | public static void main(String[] args) {
    class User (line 49) | public static class User {
      method User (line 56) | public User(Integer id, String username) {
      method getId (line 61) | public Integer getId() {
      method setId (line 65) | public void setId(Integer id) {
      method getUsername (line 69) | public String getUsername() {
      method setUsername (line 73) | public void setUsername(String username) {
      method toString (line 77) | @Override

FILE: src/main/java/com/lyncc/netty/production/example/SrvAcceptorStartup.java
  class SrvAcceptorStartup (line 5) | public class SrvAcceptorStartup {
    method main (line 7) | public static void main(String[] args) throws InterruptedException {

FILE: src/main/java/com/lyncc/netty/production/serializer/Serializer.java
  type Serializer (line 11) | public interface Serializer {
    method writeObject (line 18) | <T> byte[] writeObject(T obj);
    method readObject (line 26) | <T> T readObject(byte[] bytes, Class<T> clazz);

FILE: src/main/java/com/lyncc/netty/production/serializer/SerializerHolder.java
  class SerializerHolder (line 14) | public final class SerializerHolder {
    method serializerImpl (line 20) | public static Serializer serializerImpl() {

FILE: src/main/java/com/lyncc/netty/production/serializer/protostuff/ProtoStuffSerializer.java
  class ProtoStuffSerializer (line 23) | public class ProtoStuffSerializer implements Serializer {
    method writeObject (line 29) | @SuppressWarnings("unchecked")
    method readObject (line 44) | public <T> T readObject(byte[] bytes, Class<T> clazz) {
    method getSchema (line 55) | @SuppressWarnings("unchecked")

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/AcceptorIdleStateTrigger.java
  class AcceptorIdleStateTrigger (line 19) | @ChannelHandler.Sharable
    method userEventTriggered (line 24) | @Override

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/AcknowledgeEncoder.java
  class AcknowledgeEncoder (line 21) | @ChannelHandler.Sharable
    method encode (line 24) | @Override

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/ChannelEventListener.java
  type ChannelEventListener (line 6) | public interface ChannelEventListener {
    method onChannelConnect (line 7) | void onChannelConnect(final String remoteAddr, final Channel channel);
    method onChannelClose (line 10) | void onChannelClose(final String remoteAddr, final Channel channel);
    method onChannelException (line 13) | void onChannelException(final String remoteAddr, final Channel channel);
    method onChannelIdle (line 16) | void onChannelIdle(final String remoteAddr, final Channel channel);

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/DefaultCommonSrvAcceptor.java
  class DefaultCommonSrvAcceptor (line 56) | public class DefaultCommonSrvAcceptor extends DefaultSrvAcceptor {
    method DefaultCommonSrvAcceptor (line 75) | public DefaultCommonSrvAcceptor(int port,ChannelEventListener channelE...
    method init (line 81) | @Override
    method initEventLoopGroup (line 145) | @Override
    method bind (line 151) | @Override
    class MessageDecoder (line 202) | static class MessageDecoder extends ReplayingDecoder<MessageDecoder.St...
      method MessageDecoder (line 205) | public MessageDecoder() {
      method decode (line 212) | @Override
      method checkMagic (line 254) | private static void checkMagic(short magic) throws Signal {
      type State (line 260) | enum State {
    class MessageEncoder (line 288) | @ChannelHandler.Sharable
      method encode (line 291) | @Override
    class MessageHandler (line 303) | @ChannelHandler.Sharable
      method channelRead0 (line 306) | @Override
    class NettyConnetManageHandler (line 316) | class NettyConnetManageHandler extends ChannelDuplexHandler {
      method connect (line 318) | @Override
      method disconnect (line 331) | @Override
      method close (line 343) | @Override
      method exceptionCaught (line 356) | @Override
    method getChannelEventListener (line 368) | @Override

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/DefaultSrvAcceptor.java
  class DefaultSrvAcceptor (line 13) | public abstract class DefaultSrvAcceptor extends NettySrvAcceptor {
    method putNettyEvent (line 19) | public void putNettyEvent(final NettyEvent event) {
    method DefaultSrvAcceptor (line 23) | public DefaultSrvAcceptor(SocketAddress localAddress) {
    class NettyEventExecuter (line 27) | class NettyEventExecuter extends ServiceThread {
      method putNettyEvent (line 32) | public void putNettyEvent(final NettyEvent event) {
      method run (line 42) | public void run() {
      method getServiceName (line 79) | @Override
    method getChannelEventListener (line 85) | protected abstract ChannelEventListener getChannelEventListener();

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/NettySrvAcceptor.java
  class NettySrvAcceptor (line 27) | public abstract class NettySrvAcceptor implements SrvAcceptor {
    method newThread (line 47) | public Thread newThread(Runnable runnable) {
    method NettySrvAcceptor (line 52) | public NettySrvAcceptor(SocketAddress localAddress) {
    method NettySrvAcceptor (line 56) | public NettySrvAcceptor(SocketAddress localAddress, int nWorkers) {
    method init (line 62) | protected void init(){
    method start (line 83) | public void start() throws InterruptedException {
    method start (line 87) | public void start(boolean sync) throws InterruptedException {
    method localAddress (line 98) | public SocketAddress localAddress() {
    method bootstrap (line 102) | protected ServerBootstrap bootstrap() {
    method shutdownGracefully (line 106) | public void shutdownGracefully() {
    method initEventLoopGroup (line 111) | protected abstract EventLoopGroup initEventLoopGroup(int nthread, Thre...
    method bind (line 113) | protected abstract ChannelFuture bind(SocketAddress localAddress);

FILE: src/main/java/com/lyncc/netty/production/srv/acceptor/SrvAcceptor.java
  type SrvAcceptor (line 12) | public interface SrvAcceptor {
    method localAddress (line 14) | SocketAddress localAddress();
    method start (line 16) | void start() throws InterruptedException;
    method shutdownGracefully (line 18) | void shutdownGracefully();
    method start (line 20) | void start(boolean sync) throws InterruptedException;

FILE: src/main/java/com/lyncc/netty/stickpackage/correct/BaseClient.java
  class BaseClient (line 13) | public class BaseClient {
    method main (line 19) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/correct/BaseClientHandler.java
  class BaseClientHandler (line 14) | public class BaseClientHandler extends ChannelInboundHandlerAdapter{
    method BaseClientHandler (line 20) | public BaseClientHandler() {
    method channelActive (line 25) | @Override
    method channelRead (line 35) | @Override
    method exceptionCaught (line 45) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/correct/BaseServer.java
  class BaseServer (line 14) | public class BaseServer {
    method BaseServer (line 18) | public BaseServer(int port) {
    method start (line 22) | public void start(){
    method main (line 46) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/correct/BaseServerHandler.java
  class BaseServerHandler (line 9) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 15) | @Override
    method exceptionCaught (line 31) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseClient.java
  class BaseClient (line 17) | public class BaseClient {
    method main (line 23) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseClientHandler.java
  class BaseClientHandler (line 13) | public class BaseClientHandler extends ChannelInboundHandlerAdapter{
    method channelActive (line 19) | @Override
    method channelRead (line 26) | @Override
    method exceptionCaught (line 32) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseServer.java
  class BaseServer (line 19) | public class BaseServer {
    method BaseServer (line 23) | public BaseServer(int port) {
    method start (line 27) | public void start(){
    method main (line 58) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseServerHandler.java
  class BaseServerHandler (line 6) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 12) | @Override
    method exceptionCaught (line 19) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/error/BaseClient.java
  class BaseClient (line 15) | public class BaseClient {
    method main (line 21) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/error/BaseClientHandler.java
  class BaseClientHandler (line 14) | public class BaseClientHandler extends ChannelInboundHandlerAdapter{
    method BaseClientHandler (line 20) | public BaseClientHandler() {
    method channelActive (line 25) | @Override
    method channelRead (line 35) | @Override
    method exceptionCaught (line 42) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/error/BaseServer.java
  class BaseServer (line 16) | public class BaseServer {
    method BaseServer (line 20) | public BaseServer(int port) {
    method start (line 24) | public void start(){
    method main (line 50) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/error/BaseServerHandler.java
  class BaseServerHandler (line 8) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 14) | @Override
    method exceptionCaught (line 27) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/myself/BaseClient.java
  class BaseClient (line 14) | public class BaseClient {
    method main (line 20) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/myself/BaseClientHandler.java
  class BaseClientHandler (line 8) | public class BaseClientHandler extends ChannelInboundHandlerAdapter{
    method BaseClientHandler (line 12) | public BaseClientHandler() {
    method channelActive (line 28) | @Override
    method exceptionCaught (line 45) | @Override

FILE: src/main/java/com/lyncc/netty/stickpackage/myself/BaseServer.java
  class BaseServer (line 18) | public class BaseServer {
    method BaseServer (line 22) | public BaseServer(int port) {
    method start (line 26) | public void start(){
    method main (line 52) | public static void main(String[] args) throws Exception {

FILE: src/main/java/com/lyncc/netty/stickpackage/myself/BaseServerHandler.java
  class BaseServerHandler (line 6) | public class BaseServerHandler extends ChannelInboundHandlerAdapter{
    method channelRead (line 12) | @Override
    method exceptionCaught (line 20) | @Override
Condensed preview — 149 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (405K chars).
[
  {
    "path": "README.md",
    "chars": 360,
    "preview": "# netty-study\n\nnetty4.x知识点学习\n\n\n\n### 1) [生产级别的心跳重连](https://github.com/BazingaLyn/netty-study/tree/master/src/main/java/c"
  },
  {
    "path": "pom.xml",
    "chars": 2125,
    "preview": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLoca"
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/AttributeMapConstant.java",
    "chars": 229,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport io.netty.util.AttributeKey;\n\npublic class AttributeMapConstant {\n    \n    "
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/HelloWorld2ClientHandler.java",
    "chars": 2706,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport io.netty.channel.ChannelHandlerContext;\nimport io.netty.channel.ChannelInb"
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/HelloWorldClient.java",
    "chars": 2032,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport io.netty.bootstrap.Bootstrap;\nimport io.netty.channel.ChannelFuture;\nimpor"
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/HelloWorldClientHandler.java",
    "chars": 1861,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport static com.lyncc.netty.attributeMap.AttributeMapConstant.NETTY_CHANNEL_KEY"
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/HelloWorldServer.java",
    "chars": 2252,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport io.netty.bootstrap.ServerBootstrap;\nimport io.netty.channel.ChannelFuture;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/HelloWorldServerHandler.java",
    "chars": 709,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport io.netty.channel.ChannelHandlerContext;\nimport io.netty.channel.ChannelInb"
  },
  {
    "path": "src/main/java/com/lyncc/netty/attributeMap/NettyChannel.java",
    "chars": 589,
    "preview": "package com.lyncc.netty.attributeMap;\n\nimport java.util.Date;\n\npublic class NettyChannel {\n    \n    private String name;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/custom/ProtocolDecoder.java",
    "chars": 79,
    "preview": "package com.lyncc.netty.codec.custom;\r\n\r\n\r\npublic class ProtocolDecoder{\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/custom/ProtocolEncoder.java",
    "chars": 1014,
    "preview": "package com.lyncc.netty.codec.custom;\r\n\r\nimport java.nio.charset.Charset;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io."
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/custom/ProtocolHeader.java",
    "chars": 1223,
    "preview": "package com.lyncc.netty.codec.custom;\r\n\r\npublic class ProtocolHeader {\r\n    \r\n    private byte magic;\r\n    \r\n    private"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/custom/ProtocolMsg.java",
    "chars": 582,
    "preview": "package com.lyncc.netty.codec.custom;\r\n\r\npublic class ProtocolMsg {\r\n    \r\n    private ProtocolHeader protocolHeader = n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/JacksonClient.java",
    "chars": 1714,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.Channel;\r\nimport"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/JacksonClientHandler.java",
    "chars": 726,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel.Simple"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/JacksonClientHandlerInitializer.java",
    "chars": 554,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.channel.Channel;\r\nimport io.netty.channel.ChannelInitializer;\r"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/JacksonServer.java",
    "chars": 1481,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFut"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/JacksonServerHandler.java",
    "chars": 1133,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.channel.Channel;\r\nimport io.netty.channel.ChannelHandlerContex"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/JacksonServerHandlerInitializer.java",
    "chars": 579,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.channel.ChannelInitializer;\r\nimport io.netty.channel.ChannelPi"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/User.java",
    "chars": 798,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport java.util.List;\r\n\r\npublic class User {\r\n    \r\n    private Integer id;\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/UserDecoder.java",
    "chars": 729,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.ByteBufInputStream;\r\ni"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/UserEncoder.java",
    "chars": 567,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.ByteBufOutputStream;\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/jackson/UserMapper.java",
    "chars": 284,
    "preview": "package com.lyncc.netty.codec.jackson;\r\n\r\nimport com.fasterxml.jackson.databind.ObjectMapper;\r\n\r\npublic class UserMapper"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomClient.java",
    "chars": 1673,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.Ch"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomClientHandler.java",
    "chars": 492,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty."
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomDecoder.java",
    "chars": 2091,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.channel.Channel"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomEncoder.java",
    "chars": 796,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\nimport java.nio.charset.Charset;\r\n\r\nimport io.netty.buffer.ByteB"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomMsg.java",
    "chars": 1120,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\npublic class CustomMsg {\r\n    \r\n    //类型  系统编号 0xAB 表示A系统,0xBC 表"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomServer.java",
    "chars": 2503,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.chan"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/lengthFieldBasedFrame/CustomServerHandler.java",
    "chars": 583,
    "preview": "package com.lyncc.netty.codec.lengthFieldBasedFrame;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty."
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubReqClient.java",
    "chars": 3060,
    "preview": "/*\n * Copyright 2012 The Netty Project\n *\n * The Netty Project licenses this file to you under the Apache License,\n * ve"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubReqClientHandler.java",
    "chars": 2261,
    "preview": "/*\n * Copyright 2012 The Netty Project\n *\n * The Netty Project licenses this file to you under the Apache License,\n * ve"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubReqServer.java",
    "chars": 2652,
    "preview": "package com.lyncc.netty.codec.protobuf;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFu"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubReqServerHandler.java",
    "chars": 1875,
    "preview": "/*\n * Copyright 2012 The Netty Project\n *\n * The Netty Project licenses this file to you under the Apache License,\n * ve"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubscribeReq.proto",
    "chars": 311,
    "preview": "package netty;  \r\noption java_package = \"com.lyncc.netty.codec.protobuf\";  \r\noption java_outer_classname = \"SubscribeReq"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubscribeReqProto.java",
    "chars": 37490,
    "preview": "// Generated by the protocol buffer compiler.  DO NOT EDIT!\n// source: SubscribeReq.proto\n\npackage com.lyncc.netty.codec"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubscribeResp.proto",
    "chars": 268,
    "preview": "package netty;  \r\noption java_package = \"com.lyncc.netty.codec.protobuf\";  \r\noption java_outer_classname = \"SubscribeRes"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/SubscribeRespProto.java",
    "chars": 23926,
    "preview": "// Generated by the protocol buffer compiler.  DO NOT EDIT!\n// source: SubscribeResp.proto\n\npackage com.lyncc.netty.code"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/TestSubscribeReqProto.java",
    "chars": 1592,
    "preview": "package com.lyncc.netty.codec.protobuf;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nimport com.google.prot"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufClient.java",
    "chars": 1990,
    "preview": "package com.lyncc.netty.codec.protobuf.demo;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFut"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufClientHandler.java",
    "chars": 1552,
    "preview": "package com.lyncc.netty.codec.protobuf.demo;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel."
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufServer.java",
    "chars": 2353,
    "preview": "package com.lyncc.netty.codec.protobuf.demo;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.Chan"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/demo/ProtoBufServerHandler.java",
    "chars": 947,
    "preview": "package com.lyncc.netty.codec.protobuf.demo;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel."
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/demo/RichMan.proto",
    "chars": 493,
    "preview": "package netty;\r\n\r\noption java_package = \"com.lyncc.netty.codec.protobuf.demo\";\r\noption java_outer_classname = \"RichManPr"
  },
  {
    "path": "src/main/java/com/lyncc/netty/codec/protobuf/demo/RichManProto.java",
    "chars": 75142,
    "preview": "// Generated by the protocol buffer compiler.  DO NOT EDIT!\n// source: RichMan.proto\n\npackage com.lyncc.netty.codec.prot"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/channelhandler/BaseClient.java",
    "chars": 1983,
    "preview": "package com.lyncc.netty.component.channelhandler;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.Chann"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/channelhandler/BaseClient1Handler.java",
    "chars": 705,
    "preview": "package com.lyncc.netty.component.channelhandler;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.cha"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/channelhandler/BaseClient2Handler.java",
    "chars": 489,
    "preview": "package com.lyncc.netty.component.channelhandler;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.cha"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/channelhandler/BaseServer.java",
    "chars": 2429,
    "preview": "package com.lyncc.netty.component.channelhandler;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/channelhandler/BaseServerHandler.java",
    "chars": 847,
    "preview": "package com.lyncc.netty.component.channelhandler;\r\n\r\nimport io.netty.buffer.Unpooled;\r\nimport io.netty.channel.ChannelHa"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/simplehandler/BaseClient.java",
    "chars": 1922,
    "preview": "package com.lyncc.netty.component.simplehandler;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.Channe"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/simplehandler/BaseClientHandler.java",
    "chars": 798,
    "preview": "package com.lyncc.netty.component.simplehandler;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.chan"
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/simplehandler/BaseServer.java",
    "chars": 2428,
    "preview": "package com.lyncc.netty.component.simplehandler;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel."
  },
  {
    "path": "src/main/java/com/lyncc/netty/component/simplehandler/BaseServerHandler.java",
    "chars": 846,
    "preview": "package com.lyncc.netty.component.simplehandler;\r\n\r\nimport io.netty.buffer.Unpooled;\r\nimport io.netty.channel.ChannelHan"
  },
  {
    "path": "src/main/java/com/lyncc/netty/concept/HelloWorldConcept.java",
    "chars": 2354,
    "preview": "package com.lyncc.netty.concept;\r\n\r\n/**\r\n * \r\n * @author Bazingalyncc\r\n * 描述:\r\n * 时间  2016年4月29日\r\n */\r\npublic class Hell"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat/BaseClient.java",
    "chars": 2598,
    "preview": "package com.lyncc.netty.heartbeat;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFuture;\r\nimpo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat/BaseClientHandler.java",
    "chars": 2206,
    "preview": "package com.lyncc.netty.heartbeat;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.Unpooled;\r\nimport io.netty"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat/BaseServer.java",
    "chars": 2832,
    "preview": "package com.lyncc.netty.heartbeat;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFuture;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat/BaseServerHandler.java",
    "chars": 1437,
    "preview": "package com.lyncc.netty.heartbeat;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel.ChannelInb"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/AskMsg.java",
    "chars": 367,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class AskMsg extends BaseMsg {\r\n    \r\n    public AskMsg() {\r\n        super"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/AskParams.java",
    "chars": 384,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport java.io.Serializable;\r\n\r\npublic class AskParams implements Serializable{\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/BaseMsg.java",
    "chars": 680,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport java.io.Serializable;\r\n\r\npublic abstract class BaseMsg implements Serializ"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/Constants.java",
    "chars": 300,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class Constants {\r\n    \r\n    private static String clientId;\r\n\r\n    public"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/LoginMsg.java",
    "chars": 572,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class LoginMsg extends BaseMsg {\r\n    \r\n\r\n    private String userName;\r\n  "
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/MsgType.java",
    "chars": 99,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic enum MsgType {\r\n    \r\n    PING,ASK,REPLY,LOGIN\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/NettyChannelMap.java",
    "chars": 836,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport io.netty.channel.Channel;\r\nimport io.netty.channel.socket.SocketChannel;\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/NettyClientBootstrap.java",
    "chars": 3056,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFuture;\r\nimp"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/NettyClientHandler.java",
    "chars": 2520,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport io.netty.channel.Channel;\r\nimport io.netty.channel.ChannelHandlerContext;\r"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/NettyServerBootstrap.java",
    "chars": 2747,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFuture"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/NettyServerHandler.java",
    "chars": 2637,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport io.netty.channel.Channel;\r\nimport io.netty.channel.ChannelHandlerContext;\r"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/PingMsg.java",
    "chars": 170,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class PingMsg extends BaseMsg{\r\n    \r\n    public PingMsg() {\r\n        supe"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/ReplyBody.java",
    "chars": 214,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\nimport java.io.Serializable;\r\n\r\npublic class ReplyBody implements Serializable{\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/ReplyClientBody.java",
    "chars": 401,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class ReplyClientBody extends ReplyBody {\r\n    \r\n    private String client"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/ReplyMsg.java",
    "chars": 365,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class ReplyMsg extends BaseMsg {\r\n    \r\n    public ReplyMsg() {\r\n        s"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeat2/ReplyServerBody.java",
    "chars": 399,
    "preview": "package com.lyncc.netty.heartbeat2;\r\n\r\npublic class ReplyServerBody extends ReplyBody {\r\n    \r\n    private String server"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeats/HeartBeatClientHandler.java",
    "chars": 2198,
    "preview": "package com.lyncc.netty.heartbeats;\r\n\r\nimport java.util.Date;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeats/HeartBeatServer.java",
    "chars": 2607,
    "preview": "package com.lyncc.netty.heartbeats;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFuture"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeats/HeartBeatServerHandler.java",
    "chars": 1429,
    "preview": "package com.lyncc.netty.heartbeats;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel.ChannelIn"
  },
  {
    "path": "src/main/java/com/lyncc/netty/heartbeats/HeartBeatsClient.java",
    "chars": 2696,
    "preview": "package com.lyncc.netty.heartbeats;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFuture;\r\nimp"
  },
  {
    "path": "src/main/java/com/lyncc/netty/hello/HelloWorldClient.java",
    "chars": 2264,
    "preview": "package com.lyncc.netty.hello;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFuture;\r\nimport i"
  },
  {
    "path": "src/main/java/com/lyncc/netty/hello/HelloWorldClientHandler.java",
    "chars": 995,
    "preview": "package com.lyncc.netty.hello;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel.ChannelInbound"
  },
  {
    "path": "src/main/java/com/lyncc/netty/hello/HelloWorldServer.java",
    "chars": 2294,
    "preview": "package com.lyncc.netty.hello;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFuture;\r\nim"
  },
  {
    "path": "src/main/java/com/lyncc/netty/hello/HelloWorldServerHandler.java",
    "chars": 840,
    "preview": "package com.lyncc.netty.hello;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel.ChannelInbound"
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/AcceptorIdleStateTrigger.java",
    "chars": 784,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.channel.ChannelHandler;\nimport io.netty.channel.ChannelHandlerContext;\nim"
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/ChannelHandlerHolder.java",
    "chars": 323,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.channel.ChannelHandler;\n\n/**\n * \n * 客户端的ChannelHandler集合,由子类实现,这样做的好处:\n *"
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/ConnectionWatchdog.java",
    "chars": 3022,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.bootstrap.Bootstrap;\nimport io.netty.channel.Channel;\nimport io.netty.cha"
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/ConnectorIdleStateTrigger.java",
    "chars": 1089,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.buffer.ByteBuf;\nimport io.netty.buffer.Unpooled;\nimport io.netty.channel."
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/HeartBeatClientHandler.java",
    "chars": 1162,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.channel.ChannelHandler.Sharable;\nimport io.netty.channel.ChannelHandlerCo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/HeartBeatServer.java",
    "chars": 2652,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.bootstrap.ServerBootstrap;\nimport io.netty.channel.ChannelFuture;\nimport "
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/HeartBeatServerHandler.java",
    "chars": 632,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.channel.ChannelHandlerContext;\nimport io.netty.channel.ChannelInboundHand"
  },
  {
    "path": "src/main/java/com/lyncc/netty/idle/HeartBeatsClient.java",
    "chars": 2951,
    "preview": "package com.lyncc.netty.idle;\n\nimport io.netty.bootstrap.Bootstrap;\nimport io.netty.channel.Channel;\nimport io.netty.cha"
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/Constants.java",
    "chars": 157,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\npublic class Constants {\r\n\r\n\tpublic static final int REQ_CODE = 1 ;\r\n\t\r\n\tpublic st"
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/Heartbeat.java",
    "chars": 3415,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel.SimpleChan"
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/KeepAliveClient.java",
    "chars": 5813,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.Channel;\r\nimport io."
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/KeepAliveMessage.java",
    "chars": 472,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\npublic class KeepAliveMessage implements java.io.Serializable{\r\n\r\n\tprivate static "
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/KeepAliveServer.java",
    "chars": 1236,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.ChannelFuture;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/KeepAliveServerInitializer.java",
    "chars": 1215,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\nimport io.netty.channel.ChannelInitializer;\r\nimport io.netty.channel.ChannelPipeli"
  },
  {
    "path": "src/main/java/com/lyncc/netty/keepalive/Utils.java",
    "chars": 798,
    "preview": "package com.lyncc.netty.keepalive;\r\n\r\nimport java.util.Collection;\r\n\r\npublic class Utils {\r\n\r\n\t/**\r\n\t * 判断对象是否为空<br />\r\n"
  },
  {
    "path": "src/main/java/com/lyncc/netty/nio/EchoClient.java",
    "chars": 1774,
    "preview": "package com.lyncc.netty.nio;\n\nimport java.io.IOException;\nimport java.net.InetSocketAddress;\nimport java.nio.ByteBuffer;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/nio/MultiPortEchoServer.java",
    "chars": 3475,
    "preview": "package com.lyncc.netty.nio;\n\nimport java.io.IOException;\nimport java.net.InetSocketAddress;\nimport java.net.ServerSocke"
  },
  {
    "path": "src/main/java/com/lyncc/netty/nio/package-info.java",
    "chars": 110,
    "preview": "/**\n * \n */\n/**\n * @author BazingaLyn\n * @description\n * @time\n * @modifytime\n */\npackage com.lyncc.netty.nio;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/ChannelHandlerHolder.java",
    "chars": 845,
    "preview": "/*\n * Copyright (c) 2015 The Jupiter Project\n *\n * Licensed under the Apache License, version 2.0 (the \"License\");\n * yo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/ConnectionWatchdog.java",
    "chars": 3091,
    "preview": "package com.lyncc.netty.production;\n\nimport static java.util.concurrent.TimeUnit.MILLISECONDS;\nimport io.netty.bootstrap"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/client/connector/ClientConnector.java",
    "chars": 292,
    "preview": "package com.lyncc.netty.production.client.connector;\n\nimport io.netty.channel.Channel;\n\n/**\n * \n * @author BazingaLyn\n *"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/client/connector/ConnectorIdleStateTrigger.java",
    "chars": 1148,
    "preview": "package com.lyncc.netty.production.client.connector;\n\nimport io.netty.channel.ChannelHandler;\nimport io.netty.channel.Ch"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/client/connector/DefaultCommonClientConnector.java",
    "chars": 12279,
    "preview": "package com.lyncc.netty.production.client.connector;\n\nimport static com.lyncc.netty.production.common.NettyCommonProtoco"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/client/connector/NettyClientConnector.java",
    "chars": 1222,
    "preview": "package com.lyncc.netty.production.client.connector;\n\nimport io.netty.bootstrap.Bootstrap;\nimport io.netty.buffer.ByteBu"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/client/connector/package-info.java",
    "chars": 134,
    "preview": "/**\n * \n */\n/**\n * @author BazingaLyn\n * @description\n * @time\n * @modifytime\n */\npackage com.lyncc.netty.production.cli"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/Acknowledge.java",
    "chars": 1053,
    "preview": "/*\n * Copyright (c) 2015 The Jupiter Project\n *\n * Licensed under the Apache License, version 2.0 (the \"License\");\n * yo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/Heartbeats.java",
    "chars": 897,
    "preview": "package com.lyncc.netty.production.common;\n\nimport static com.lyncc.netty.production.common.NettyCommonProtocol.HEAD_LEN"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/Message.java",
    "chars": 1865,
    "preview": "/*\n * Copyright (c) 2015 The Jupiter Project\n *\n * Licensed under the Apache License, version 2.0 (the \"License\");\n * yo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/NativeSupport.java",
    "chars": 653,
    "preview": "package com.lyncc.netty.production.common;\n\n/**\n * \n * @author BazingaLyn\n * @description\n * @copyright fjc\n * @time 201"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/NettyCommonProtocol.java",
    "chars": 1537,
    "preview": "package com.lyncc.netty.production.common;\n\n/**\n * \n * @author BazingaLyn\n * @description Netty的C/S端的之间约定的协议\n * @time 20"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/NettyEvent.java",
    "chars": 1482,
    "preview": "/**\n * Copyright (C) 2010-2013 Alibaba Group Holding Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \""
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/NettyEventType.java",
    "chars": 840,
    "preview": "/**\n * Copyright (C) 2010-2013 Alibaba Group Holding Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \""
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/ServiceThread.java",
    "chars": 3033,
    "preview": "package com.lyncc.netty.production.common;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n\npublic abstract c"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/exception/ConnectFailedException.java",
    "chars": 1213,
    "preview": "/*\n * Copyright (c) 2015 The Jupiter Project\n *\n * Licensed under the Apache License, version 2.0 (the \"License\");\n * yo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/common/package-info.java",
    "chars": 139,
    "preview": "/**\n * @author BazingaLyn\n * @description 一些用的基本类\n * @time 2016年7月20日16:50:10\n * @modifytime\n */\npackage com.lyncc.netty"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/example/ClientConnectorStartup.java",
    "chars": 2170,
    "preview": "package com.lyncc.netty.production.example;\n\nimport static com.lyncc.netty.production.common.NettyCommonProtocol.REQUEST"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/example/SrvAcceptorStartup.java",
    "chars": 369,
    "preview": "package com.lyncc.netty.production.example;\n\nimport com.lyncc.netty.production.srv.acceptor.DefaultCommonSrvAcceptor;\n\np"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/example/package-info.java",
    "chars": 148,
    "preview": "/**\n * \n */\n/**\n * @author BazingaLyn\n * @description 测试包\n * @time 2016年7月27日08:58:55\n * @modifytime\n */\npackage com.lyn"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/serializer/Serializer.java",
    "chars": 435,
    "preview": "package com.lyncc.netty.production.serializer;\n\n\n/**\n * \n * @author BazingaLyn\n * @description 序列化工具接口\n * @time 2016年7月2"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/serializer/SerializerHolder.java",
    "chars": 527,
    "preview": "\npackage com.lyncc.netty.production.serializer;\n\nimport com.lyncc.netty.production.serializer.protostuff.ProtoStuffSeria"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/serializer/protostuff/ProtoStuffSerializer.java",
    "chars": 1736,
    "preview": "package com.lyncc.netty.production.serializer.protostuff;\n\nimport io.protostuff.LinkedBuffer;\nimport io.protostuff.Proto"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/AcceptorIdleStateTrigger.java",
    "chars": 1091,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport io.netty.channel.ChannelHandler;\nimport io.netty.channel.Channe"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/AcknowledgeEncoder.java",
    "chars": 1088,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport static com.lyncc.netty.production.common.NettyCommonProtocol.AC"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/ChannelEventListener.java",
    "chars": 430,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport io.netty.channel.Channel;\n\n\npublic interface ChannelEventListen"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/DefaultCommonSrvAcceptor.java",
    "chars": 14532,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport static com.lyncc.netty.production.common.NettyCommonProtocol.HE"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/DefaultSrvAcceptor.java",
    "chars": 3060,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport java.net.SocketAddress;\nimport java.util.concurrent.LinkedBlock"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/NettySrvAcceptor.java",
    "chars": 3593,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport io.netty.bootstrap.ServerBootstrap;\nimport io.netty.buffer.Byte"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/SrvAcceptor.java",
    "chars": 395,
    "preview": "package com.lyncc.netty.production.srv.acceptor;\n\nimport java.net.SocketAddress;\n\n/**\n * \n * @author BazingaLyn\n * @desc"
  },
  {
    "path": "src/main/java/com/lyncc/netty/production/srv/acceptor/package-info.java",
    "chars": 288,
    "preview": "/**\n * @author BazingaLyn\n * netty生成级别的server/client端的模板代码\n * \n * 不一定任何场合都适用,但是自我感觉是一种比较规范的写法\n * \n * 参考 RPC框架 Jupiter ht"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/correct/BaseClient.java",
    "chars": 1683,
    "preview": "package com.lyncc.netty.stickpackage.correct;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFu"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/correct/BaseClientHandler.java",
    "chars": 1430,
    "preview": "package com.lyncc.netty.stickpackage.correct;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.Unpooled;\r\nimpo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/correct/BaseServer.java",
    "chars": 2021,
    "preview": "package com.lyncc.netty.stickpackage.correct;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.Cha"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/correct/BaseServerHandler.java",
    "chars": 1391,
    "preview": "package com.lyncc.netty.stickpackage.correct;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.Unpooled;\r\nimpo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseClient.java",
    "chars": 2127,
    "preview": "package com.lyncc.netty.stickpackage.delimiter;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.buffer.ByteBuf;"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseClientHandler.java",
    "chars": 1036,
    "preview": "package com.lyncc.netty.stickpackage.delimiter;\r\n\r\nimport io.netty.buffer.Unpooled;\r\nimport io.netty.channel.ChannelHand"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseServer.java",
    "chars": 2624,
    "preview": "package com.lyncc.netty.stickpackage.delimiter;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.buffer.By"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/delimiter/BaseServerHandler.java",
    "chars": 654,
    "preview": "package com.lyncc.netty.stickpackage.delimiter;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.chann"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/error/BaseClient.java",
    "chars": 1908,
    "preview": "package com.lyncc.netty.stickpackage.error;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFutu"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/error/BaseClientHandler.java",
    "chars": 1294,
    "preview": "package com.lyncc.netty.stickpackage.error;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.Unpooled;\r\nimport"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/error/BaseServer.java",
    "chars": 2284,
    "preview": "package com.lyncc.netty.stickpackage.error;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.channel.Chann"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/error/BaseServerHandler.java",
    "chars": 1139,
    "preview": "package com.lyncc.netty.stickpackage.error;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.Unpooled;\r\nimport"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/myself/BaseClient.java",
    "chars": 1822,
    "preview": "package com.lyncc.netty.stickpackage.myself;\r\n\r\nimport io.netty.bootstrap.Bootstrap;\r\nimport io.netty.channel.ChannelFut"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/myself/BaseClientHandler.java",
    "chars": 2533,
    "preview": "package com.lyncc.netty.stickpackage.myself;\r\n\r\nimport io.netty.buffer.ByteBuf;\r\nimport io.netty.buffer.Unpooled;\r\nimpor"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/myself/BaseServer.java",
    "chars": 2426,
    "preview": "package com.lyncc.netty.stickpackage.myself;\r\n\r\nimport io.netty.bootstrap.ServerBootstrap;\r\nimport io.netty.buffer.Unpoo"
  },
  {
    "path": "src/main/java/com/lyncc/netty/stickpackage/myself/BaseServerHandler.java",
    "chars": 716,
    "preview": "package com.lyncc.netty.stickpackage.myself;\r\n\r\nimport io.netty.channel.ChannelHandlerContext;\r\nimport io.netty.channel."
  },
  {
    "path": "src/main/resources/logback.xml",
    "chars": 1637,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\n<!--\n  ~ Copyright (c) 2015 The Jupiter Project\n  ~\n  ~ Licensed under the Apac"
  }
]

About this extraction

This page contains the full source code of the BazingaLyn/netty-study GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 149 files (357.3 KB), approximately 82.2k tokens, and a symbol index with 949 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!