inserted debugging statements - found that InputStream.read(byte[]) blocks indefinitely