@@ -0,0 +1,1756 @@
+package com.github.booknara.nioexample;%0A%0Aimport java.io.IOException;%0Aimport java.net.InetSocketAddress;%0Aimport java.nio.channels.ServerSocketChannel;%0Aimport java.nio.channels.SocketChannel;%0A%0A/**%0A * Created by Daehee Han(@daniel_booknara) on 2/12/16.%0A */%0Apublic class ServerSocketChannelExample %7B%0A    public static void main(String%5B%5D args) %7B%0A        listenBlockServerSocketChannel();%0A        listenNonBlockServerSocketChannel();%0A    %7D%0A%0A    public static void listenBlockServerSocketChannel() %7B%0A        try %7B%0A            ServerSocketChannel serverSocketChannel = createServerSocketChannel(true);%0A%0A            while (true) %7B%0A                SocketChannel socketChannel = serverSocketChannel.accept();%0A%0A                // Do something...%0A            %7D%0A%0A//            channel.close();%0A        %7D catch (IOException e) %7B%0A            e.getStackTrace();%0A        %7D%0A%0A    %7D%0A%0A    public static void listenNonBlockServerSocketChannel() %7B%0A        try %7B%0A            ServerSocketChannel serverSocketChannel = createServerSocketChannel(true);%0A%0A            while (true) %7B%0A                SocketChannel socketChannel = serverSocketChannel.accept();%0A%0A                // Need to check out incoming SocketChannel whether it's ready or not%0A                if (socketChannel != null) %7B%0A                    // Do something...%0A                %7D%0A%0A            %7D%0A%0A//            channel.close();%0A        %7D catch (IOException e) %7B%0A            e.getStackTrace();%0A        %7D%0A%0A    %7D%0A%0A    public static ServerSocketChannel createServerSocketChannel(boolean blockMode) throws IOException%7B%0A        ServerSocketChannel channel = ServerSocketChannel.open();%0A        channel.configureBlocking(blockMode);%0A        channel.socket().bind(new InetSocketAddress(1025));%0A%0A        return channel;%0A    %7D%0A%7D%0A

Add ServerSocketChannel example