Do you see any logging on server/client?
I have tried replicating your program here, and I couldn't get any failures.
One thing though.. I'm not sure why you're using a BufferedInputStream, since the ByteArray is already complete.
You usually need a BufferedStream when dealing with reading files or sockets to avoid extra calls to the OS resource.
The bug is in your code. You don't flush the ByteArrayOutputStream before retrieving the String.