This tip shows you how to create a ServerSocketChannel, to which you'll then associate a standard ServerSocket:
//create the ServerSocketChannel
try{
serverNIO=ServerSocketChannel.open();
serverNIO.configureBlocking(false);
}catch(IOException e)
{System.out.println("\nError: " + e.getMessage());}
//indicate the host and the port
try{
InetAddress addr=InetAddress.getByName("localhost");
ISA=new InetSocketAddress(addr,port);
}catch(UnknownHostException e)
{System.out.println("\nError: " + e.getMessage());}
//connect a ServerSocket to a ServerSocketChannel
try{
ServerSocket SS=serverNIO.socket();
SS.bind(ISA);
System.out.println("- Ready -");
}catch(IOException e)
{System.out.println("\nError: " + e.getMessage());}