If you are using non-blocking sockets, you can't rely on available() anymore. You have to call the read method in the SocketChannel with a byte buffer and check that you have read enough data: "read() cannot read any more bytes than are immediately available from the socket's input buffer".
As usual I'd recommend using a framework. And for writing high-performance network apps I'd suggest:
http://directory.apache.org/subprojects/mina/getting_started.html I've used it succesfully in a project that required non-blocking sockets.
/M