Chapter 1. Netty—asynchronous and event-driven
Listing 1.1. Blocking I/O example
Listing 1.2. ChannelHandler triggered by a callback
Chapter 2. Your first Netty application
Listing 2.1. EchoServerHandler
Listing 2.3. ChannelHandler for the client
Listing 2.4. Main class for the client
Chapter 4. Transports
Listing 4.1. Blocking networking without Netty
Listing 4.2. Asynchronous networking without Netty
Listing 4.3. Blocking networking with Netty
Listing 4.4. Asynchronous networking with Netty
Chapter 5. ByteBuf
Listing 5.2. Direct buffer data access
Listing 5.3. Composite buffer pattern using ByteBuffer
Listing 5.4. Composite buffer pattern using CompositeByteBuf
Listing 5.5. Accessing the data in a CompositeByteBuf
Listing 5.9. Using ByteBufProcessor to find
Listing 5.11. Copying a ByteBuf
Listing 5.12. get() and set() usage
Listing 5.13. read() and write() operations on the ByteBuf
Listing 5.14. Obtaining a ByteBufAllocator reference
Chapter 6. ChannelHandler and ChannelPipeline
Listing 6.1. Releasing message resources
Listing 6.2. Using SimpleChannelInboundHandler
Listing 6.3. Consuming and releasing an inbound message
Listing 6.4. Discarding and releasing outbound data
Listing 6.5. Modify the ChannelPipeline
Listing 6.6. Accessing the Channel from a ChannelHandlerContext
Listing 6.7. Accessing the ChannelPipeline from a ChannelHandlerContext
Listing 6.8. Calling ChannelHandlerContext write()
Listing 6.9. Caching a ChannelHandlerContext
Listing 6.10. A sharable ChannelHandler
Listing 6.11. Invalid usage of @Sharable
Listing 6.12. Basic inbound exception handling
Listing 6.13. Adding a ChannelFutureListener to a ChannelFuture
Listing 6.14. Adding a ChannelFutureListener to a ChannelPromise
Chapter 7. EventLoop and threading model
Listing 7.1. Executing tasks in an event loop
Listing 7.2. Scheduling a task with a ScheduledExecutorService
Listing 7.3. Scheduling a task with EventLoop
Chapter 8. Bootstrapping
Listing 8.1. Bootstrapping a client
Listing 8.2. Compatible EventLoopGroups and Channels
Listing 8.3. Incompatible Channel and EventLoopGroup
Listing 8.4. Bootstrapping a server
Listing 8.5. Bootstrapping a server
Listing 8.6. Bootstrapping and using ChannelInitializer
Chapter 9. Unit testing
Listing 9.1. FixedLengthFrameDecoder
Listing 9.2. Testing the FixedLengthFrameDecoder
Listing 9.3. AbsIntegerEncoder
Listing 9.4. Testing the AbsIntegerEncoder
Chapter 10. The codec framework
Listing 10.1. Class ToIntegerDecoder extends ByteToMessageDecoder
Listing 10.2. Class ToIntegerDecoder2 extends ReplayingDecoder
Listing 10.3. Class IntegerToStringDecoder
Listing 10.4. TooLongFrameException
Listing 10.5. Class ShortToByteEncoder
Listing 10.6. Class IntegerToStringEncoder
Listing 10.7. Using MessageToMessageCodec
Listing 10.8. Class ByteToCharDecoder
Chapter 11. Provided ChannelHandlers and codecs
Listing 11.1. Adding SSL/TLS support
Listing 11.2. Adding support for HTTP
Listing 11.3. Automatically aggregating HTTP message fragments
Listing 11.4. Automatically compressing HTTP messages
Listing 11.6. Supporting WebSocket on the server
Listing 11.7. Sending heartbeats
Listing 11.8. Handling line-delimited frames
Listing 11.9. Using a ChannelInitializer as a decoder installer
Listing 11.10. Decoder for the command and the handler
Listing 11.11. Transferring file contents with FileRegion
Listing 11.12. Transferring file contents with ChunkedStream
Chapter 12. WebSocket
Listing 12.1. HTTPRequestHandler
Listing 12.2. Handling text frames
Listing 12.3. Initializing the ChannelPipeline
Listing 12.4. Bootstrapping the server
Listing 12.5. Compile and start the ChatServer
Listing 12.6. Adding encryption to the ChannelPipeline
Chapter 13. Broadcasting events with UDP
Listing 13.1. LogEvent message
Listing 13.3. LogEventBroadcaster
Listing 13.4. Compile and start the LogEventBroadcaster
Listing 13.5. Compile and start the LogEventBroadcaster
Listing 13.9. Compiling and starting the LogEventBroadcaster
Chapter 14. Case studies, part 1
Listing 14.1. Setting up the ChannelPipeline
Listing 14.2. The RequestController
Listing 14.3. Setting up the ChannelPipeline
Chapter 15. Case studies, part 2
Listing 15.1. Setting up the ChannelFactory
Listing 15.2. Connecting to a remote host
Listing 15.3. Netty3-based transport
Listing 15.4. Netty-based Listener
Appendix Introduction to Maven
Listing A.3. Plugin inheritance
Listing A.4. Standalone pom.xml
Listing A.5. chapter2 directory tree