I want to asynchronously read all bytes from the InputStream of an active tcp connection. There could be nothing in the inputbuffer, in this case I want an empty byte array[] and NOT a read/timeout.
I tried this:
byte[] bytes = IOUtils.toByteArray(tcpInputStream);
But if there is nothing in the InputStream the read hangs until the tcp timeout and then an exception is thrown.