Changed read call to be iterative not recursive.

Using an SSL socket on Android causes a StackOverflowException when reading a large message.

This change gets rid of the recursive read, and switches it to an iterative version, avoiding the unnecessary stack growth.