Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Foreword

Preface

Acknowledgments

About this Book

About the Cover Illustration

1. Netty concepts and architecture

Chapter 1. Netty—asynchronous and event-driven

1.1. Networking in Java

1.1.1. Java NIO

1.1.2. Selectors

1.2. Introducing Netty

1.2.1. Who uses Netty?

1.2.2. Asynchronous and event-driven

1.3. Netty’s core components

1.3.1. Channels

1.3.2. Callbacks

1.3.3. Futures

1.3.4. Events and handlers

1.3.5. Putting it all together

1.4. Summary

Chapter 2. Your first Netty application

2.1. Setting up the development environment

2.1.1. Obtaining and installing the Java Development Kit

2.1.2. Downloading and installing an IDE

2.1.3. Downloading and installing Apache Maven

2.1.4. Configuring the toolset

2.2. Netty client/server overview

2.3. Writing the Echo server

2.3.1. ChannelHandlers and business logic

2.3.2. Bootstrapping the server

2.4. Writing an Echo client

2.4.1. Implementing the client logic with ChannelHandlers

2.4.2. Bootstrapping the client

2.5. Building and running the Echo server and client

2.5.1. Running the build

2.5.2. Running the Echo server and client

2.6. Summary

Chapter 3. Netty components and design

3.1. Channel, EventLoop, and ChannelFuture

3.1.1. Interface Channel

3.1.2. Interface EventLoop

3.1.3. Interface ChannelFuture

3.2. ChannelHandler and ChannelPipeline

3.2.1. Interface ChannelHandler

3.2.2. Interface ChannelPipeline

3.2.3. A closer look at ChannelHandlers

3.2.4. Encoders and decoders

3.2.5. Abstract class SimpleChannelInboundHandler

3.3. Bootstrapping

3.4. Summary

Chapter 4. Transports

4.1. Case study: transport migration

4.1.1. Using OIO and NIO without Netty

4.1.2. Using OIO and NIO with Netty

4.1.3. Non-blocking Netty version

4.2. Transport API

4.3. Included transports

4.3.1. NIO—non-blocking I/O

4.3.2. Epoll—native non-blocking transport for Linux

4.3.3. OIO—old blocking I/O

4.3.4. Local transport for communication within a JVM

4.3.5. Embedded transport

4.4. Transport use cases

4.5. Summary

Chapter 5. ByteBuf

5.1. The ByteBuf API

5.2. Class ByteBuf—Netty’s data container

5.2.1. How it works

5.2.2. ByteBuf usage patterns

5.3. Byte-level operations

5.3.1. Random access indexing

5.3.2. Sequential access indexing

5.3.3. Discardable bytes

5.3.4. Readable bytes

5.3.5. Writable bytes

5.3.6. Index management

5.3.7. Search operations

5.3.8. Derived buffers

5.3.9. Read/write operations

5.3.10. More operations

5.4. Interface ByteBufHolder

5.5. ByteBuf allocation

5.5.1. On-demand: interface ByteBufAllocator

5.5.2. Unpooled buffers

5.5.3. Class ByteBufUtil

5.6. Reference counting

5.7. Summary

Chapter 6. ChannelHandler and ChannelPipeline

6.1. The ChannelHandler family

6.1.1. The Channel lifecycle

6.1.2. The ChannelHandler lifecycle

6.1.3. Interface ChannelInboundHandler

6.1.4. Interface ChannelOutboundHandler

6.1.5. ChannelHandler adapters

6.1.6. Resource management

6.2. Interface ChannelPipeline

6.2.1. Modifying a ChannelPipeline

6.2.2. Firing events

6.3. Interface ChannelHandlerContext

6.3.1. Using ChannelHandlerContext

6.3.2. Advanced uses of ChannelHandler and ChannelHandlerContext

6.4. Exception handling

6.4.1. Handling inbound exceptions

6.4.2. Handling outbound exceptions

6.5. Summary

Chapter 7. EventLoop and threading model

7.1. Threading model overview

7.2. Interface EventLoop

7.2.1. I/O and event handling in Netty 4

7.2.2. I/O operations in Netty 3

7.3. Task scheduling

7.3.1. JDK scheduling API

7.3.2. Scheduling tasks using EventLoop

7.4. Implementation details

7.4.1. Thread management

7.4.2. EventLoop/thread allocation

7.5. Summary

Chapter 8. Bootstrapping

8.1. Bootstrap classes

8.2. Bootstrapping clients and connectionless protocols

8.2.1. Bootstrapping a client

8.2.2. Channel and EventLoopGroup compatibility

8.3. Bootstrapping servers

8.3.1. The ServerBootstrap class

8.3.2. Bootstrapping a server

8.4. Bootstrapping clients from a Channel

8.5. Adding multiple ChannelHandlers during a bootstrap

8.6. Using Netty ChannelOptions and attributes

8.7. Bootstrapping DatagramChannels

8.8. Shutdown

8.9. Summary

Chapter 9. Unit testing

9.1. Overview of EmbeddedChannel

9.2. Testing ChannelHandlers with EmbeddedChannel

9.2.1. Testing inbound messages

9.2.2. Testing outbound messages

9.3. Testing exception handling

9.4. Summary

2. Codecs

Chapter 10. The codec framework

10.1. What is a codec?

10.2. Decoders

10.2.1. Abstract class ByteToMessageDecoder

10.2.2. Abstract class ReplayingDecoder

10.2.3. Abstract class MessageToMessageDecoder

10.2.4. Class TooLongFrameException

10.3. Encoders

10.3.1. Abstract class MessageToByteEncoder

10.3.2. Abstract class MessageToMessageEncoder

10.4. Abstract codec classes

10.4.1. Abstract class ByteToMessageCodec

10.4.2. Abstract class MessageToMessageCodec

10.4.3. Class CombinedChannelDuplexHandler

10.5. Summary

Chapter 11. Provided ChannelHandlers and codecs

11.1. Securing Netty applications with SSL/TLS

11.2. Building Netty HTTP/HTTPS applications

11.2.1. HTTP decoder, encoder, and codec

11.2.2. HTTP message aggregation

11.2.3. HTTP compression

11.2.4. Using HTTPS

11.2.5. WebSocket

11.3. Idle connections and timeouts

11.4. Decoding delimited and length-based protocols

11.4.1. Delimited protocols

11.4.2. Length-based protocols

11.5. Writing big data

11.6. Serializing data

11.6.1. JDK serialization

11.6.2. Serialization with JBoss Marshalling

11.6.3. Serialization via Protocol Buffers

11.7. Summary

3. Network protocols

Chapter 12. WebSocket

12.1. Introducing WebSocket

12.2. Our example WebSocket application

12.3. Adding WebSocket support

12.3.1. Handling HTTP requests

12.3.2. Handling WebSocket frames

12.3.3. Initializing the ChannelPipeline

12.3.4. Bootstrapping

12.4. Testing the application

12.4.1. What about encryption?

12.5. Summary

Chapter 13. Broadcasting events with UDP

13.1. UDP basics

13.2. UDP broadcast

13.3. The UDP sample application

13.4. The message POJO: LogEvent

13.5. Writing the broadcaster

13.6. Writing the monitor

13.7. Running the LogEventBroadcaster and LogEventMonitor

13.8. Summary

4. Case studies

Chapter 14. Case studies, part 1

14.1. Droplr—building mobile services

14.1.1. How it all started

14.1.2. How Droplr works

14.1.3. Creating a faster upload experience

14.1.4. The technology stack

14.1.5. Performance

14.1.6. Summary—standing on the shoulders of giants

14.2. Firebase—a real-time data synchronization service

14.2.1. The Firebase architecture

14.2.2. Long polling

14.2.3. HTTP 1.1 keep-alive and pipelining

14.2.4. Control of SslHandler

14.2.5. Firebase summary

14.3. Urban Airship—building mobile services

14.3.1. Basics of mobile messaging

14.3.2. Third-party delivery

14.3.3. Binary protocol example

14.3.4. Direct to device delivery

14.3.5. Netty excels at managing large numbers of concurrent connections

14.3.6. Summary—Beyond the perimeter of the firewall

14.4. Summary

Chapter 15. Case studies, part 2

15.1. Netty at Facebook: Nifty and Swift

15.1.1. What is Thrift?

15.1.2. Improving the state of Java Thrift using Netty

15.1.3. Nifty server design

15.1.4. Nifty asynchronous client design

15.1.5. Swift: a faster way to build Java Thrift service

15.1.6. Results

15.1.7. Facebook summary

15.2. Netty at Twitter: Finagle

15.2.1. Twitter’s growing pains

15.2.2. The birth of Finagle

15.2.3. How Finagle works

15.2.4. Finagle’s abstraction

15.2.5. Failure management

15.2.6. Composing services

15.2.7. The future: Netty

15.2.8. Twitter summary

15.3. Summary

Introduction to Maven

A.1. What is Maven?

A.1.1. Installing and configuring Maven

A.1.2. Basic Maven concepts

A.2. POM examples

A.2.1. A project POM

A.2.2. POM inheritance and aggregation

A.3. Maven command-line

A.4. Summary

Index

List of Figures

List of Tables

List of Listings

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset