protected byte[] convertInputStreamToByteArray(InputStream in) throws IOException {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        int c = -1;
        while ((c = in.read()) != -1) {
            outputStream.write(c);
        }
        outputStream.flush();
        in.close();
        return outputStream.toByteArray();
    }
protected byte [ ] convertInputStreamToByteArray ( InputStream in ) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; int c = - 1 ; while ( ( c = in . read ( ) ) != - 1 ) { outputStream . write ( c ) ; } outputStream . flush ( ) ; in . close ( ) ; return outputStream . toByteArray ( ) ; }
/*this is required to fix proxy authentication retry failure
caused by org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity