public byte[] getResponseFromUrl(String urlStr) throws Exception
    {
        URL url = new URL(urlStr);
        int retries = 6;
        int msWait = 200;
        
        while(retries > 0){
        	InputStream responseStream = null;
        	try {
	        	
		        URLConnection connection = url.openConnection();
		        connection.setDoOutput(true);
		        connection.setDoInput(true);
		        connection.setUseCaches(false);

		        if(getFileToPost() == null){
		            responseStream = connection.getInputStream();
		        }
		        else {
		            File f = new File(getFileToPost());
		            responseStream = postFile(connection, "filedata", f);
		        }
		        
		        ByteArrayOutputStream responseBytes = new ByteArrayOutputStream();
		        Utils.bufferedCopyStream(responseStream, responseBytes);
		        responseBytes.close();
		        
		        //System.err.println(new String(responseBytes.toByteArray(), "UTF-8"));
		        
		        return responseBytes.toByteArray();
		        
	        } 
	        catch (IOException ioe) {
	        	Thread.sleep(msWait);
	        	retries--;
	        	msWait *= 2;
	        	if(retries == 0){
	        		throw ioe;
	        	}
	        }
	        finally {
	        	if(responseStream != null){
	        		responseStream.close();
	        	}
	        }
        }
        throw new Exception("Could not retrieve a response from " + this.getServer());
    }