Chapter 8. Bootstrapping

This chapter covers

  • Bootstrapping clients and servers
  • Bootstrapping clients from within a Channel
  • Adding ChannelHandlers
  • Using ChannelOptions and attributes

Having studied ChannelPipelines, ChannelHandlers, and codec classes in depth, your next question is probably, “How do all these pieces add up to a working application?”

The answer? “Bootstrapping.” Up to now, we’ve used the term somewhat vaguely, and the time has come to define it more precisely. Simply stated, bootstrapping an application is the process of configuring it to run—though the details of the process may not be as simple as its definition, especially in network applications.

Consistent with its approach to application architecture, Netty handles bootstrapping in a way that insulates your application, whether client or server, from the network layer. As you’ll see, all of the framework components are connected and enabled in the background. Bootstrapping is the missing piece of the puzzle we’ve been assembling; when you put it in place, your Netty application will be complete.

8.1. Bootstrap classes

The bootstrapping class hierarchy consists of an abstract parent class and two concrete bootstrap subclasses, as shown in figure 8.1.

Figure 8.1. Bootstrapping class hierarchy

8.2. Bootstrapping clients and connectionless protocols

8.3. Bootstrapping servers

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

sitemap