If you spend much time creating socket-based network programs, it won't take long for you to notice a simple pattern. You usually create a main class that listens for incoming socket connections. You then create a separate class (or an inner class) to handle the new connection in a separate thread. Because the only thing that really changes is the way you handle the clients, why not create a generic socket service to make it easier to create socket applications?
You start by creating a common interface for client handlers, like the one shown in Listing 40.4.
package usingj2ee.dynclass; import java.net.*; public interface ClientHandler extends ...