Connect a non-blocking SocketChannel to a server and get the associated Socket. From the Socket get the associated InputStream. Close the SocketChannel and then read from the InputStream. A ClosedChannelException is expected but instead we get an IllegalBlockingModeException. While it is true that the blocking mode is illegal, the SocketChannel being closed, the blocking mode is unimportant for a read() operation.
When the SocketChannel is in blocking mode, the correct exception (ClosedChannelException) is thrown.
A sample application that reproduces this problem is attached.
Seen on:
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)