I was playing with scala (newbie) and I was trying to use Java 7 NIO (because I like to start easy). But I can't work out how to instantiate the CompletionHandler for the accept. The following code is wrong and I can't fix it:
package async
import java.nio.channels.AsynchronousServerSocketChannel
import java.net.InetAddress
import java.net.InetSocketAddress
import java.nio.channels.CompletionHandler
import java.nio.channels.AsynchronousSocketChannel
class AsyncServer (port: Int) {
val socketServer = AsynchronousServerSocketChannel.open();
socketServer.bind(new InetSocketAddress(port))
val connectionHandler = new CompletionHandler[AsynchronousSocketChannel, Integer](){
}
def init() = socketServer accept(1 , connectionHandler)
}