42 import java.nio.channels.*;
43 import javax.net.ssl.*;
52 class AcceptHandler
implements Handler {
54 private ServerSocketChannel channel;
55 private Dispatcher dsp;
57 private SSLContext sslContext;
59 AcceptHandler(ServerSocketChannel ssc, Dispatcher dsp,
60 SSLContext sslContext) {
63 this.sslContext = sslContext;
66 public void handle(SelectionKey sk)
throws IOException {
68 if (!sk.isAcceptable())
71 SocketChannel sc = channel.accept();
76 ChannelIO cio = (sslContext !=
null ?
77 ChannelIOSecure.getInstance(
78 sc,
false , sslContext) :
79 ChannelIO.getInstance(
82 RequestHandler rh =
new RequestHandler(cio);
83 dsp.register(cio.getSocketChannel(), SelectionKey.OP_READ, rh);