ドキュメントをご覧ください: http://netty.io/docs/stable/guide/html/。セクション 9. アプリケーションのシャットダウンまでスクロールします。
メインアプリは次のようになります。
package org.jboss.netty.example.time;
public class TimeServer {
    static final ChannelGroup allChannels = new DefaultChannelGroup("time-server"(35));
    public static void main(String[] args) throws Exception {
        ...
        ChannelFactory factory = ...;
        ServerBootstrap bootstrap = ...;
        ...
        Channel channel = bootstrap.bind(...);
        allChannels.add(channel);
        ...
        // Shutdown code
        ChannelGroupFuture future = allChannels.close();
        future.awaitUninterruptibly();
        factory.releaseExternalResources();
    }
}
ハンドラーには次のものが必要です。
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {
    TimeServer.allChannels.add(e.getChannel());
}
1. すべてのチャネルをChannelGroup
2. に保存します。シャットダウンするときは、すべてのチャネルを閉じてリソースを解放します。
お役に立てれば。