Search in sources :

Example 21 with AsynchronousServerSocketChannel

use of java.nio.channels.AsynchronousServerSocketChannel in project j2objc by google.

the class AsynchronousServerSocketChannelTest method test_completionHandlerAccept_npe.

public void test_completionHandlerAccept_npe() throws Throwable {
    AsynchronousServerSocketChannel assc = AsynchronousServerSocketChannel.open();
    assc.bind(new InetSocketAddress(0));
    try {
        assc.accept(null, /* attachment */
        null);
        fail();
    } catch (NullPointerException expected) {
    }
    assc.close();
}
Also used : InetSocketAddress(java.net.InetSocketAddress) AsynchronousServerSocketChannel(java.nio.channels.AsynchronousServerSocketChannel)

Aggregations

AsynchronousServerSocketChannel (java.nio.channels.AsynchronousServerSocketChannel)21 InetSocketAddress (java.net.InetSocketAddress)15 AsynchronousSocketChannel (java.nio.channels.AsynchronousSocketChannel)12 AlreadyBoundException (java.nio.channels.AlreadyBoundException)4 ExecutionException (java.util.concurrent.ExecutionException)4 ServerSocket (java.net.ServerSocket)3 Socket (java.net.Socket)3 ClosedChannelException (java.nio.channels.ClosedChannelException)3 NotYetBoundException (java.nio.channels.NotYetBoundException)3 UnresolvedAddressException (java.nio.channels.UnresolvedAddressException)3 IOException (java.io.IOException)2 BindException (java.net.BindException)2 ByteBuffer (java.nio.ByteBuffer)2 AsynchronousChannelGroup (java.nio.channels.AsynchronousChannelGroup)2 AsynchronousCloseException (java.nio.channels.AsynchronousCloseException)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Inet6Address (java.net.Inet6Address)1 SocketOption (java.net.SocketOption)1 AsynchronousChannelProvider (java.nio.channels.spi.AsynchronousChannelProvider)1 Path (java.nio.file.Path)1