Code example for AuthenticationException

        final String response = EntityUtils.toString(resp.getEntity());
        if (resp.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
            if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
                Log.e(TAG, "Authentication exception in sending dirty contacts");
                throw new AuthenticationException();
            } else { 
                Log.e(TAG, "Server error in sending dirty contacts: " + resp.getStatusLine());
                throw new IOException();
        // Our request to the server was successful - so we assume 
        // that they accepted all the changes we sent up, and 
        // that the response includes the contacts that we need 
        // to update on our side... 
        Log.d(TAG, response);
        final JSONArray hackerList = new JSONArray(response);