SubscriptionChangeHandler extends AsyncHttpResponseHandler { @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { InterestSubscriptionChange change = subscription.getChange(); InterestSubscriptionChangeListener listener = subscription.getListener(); String interest = subscription.getInterest(); String log = "Received status " + statusCode; String responseBodyString = new String(); if (responseBody != null) { responseBodyString = new String(responseBody); log += " with: " + responseBodyString; } Log.e("PInterestSubChange", log); Log.e(TAG, "[subscription change] " + "Could not " + change + " to " + interest + "."); if (listener != null) listener.onSubscriptionChangeFailed(statusCode, responseBodyString); } SubscriptionChangeHandler(
            Subscription subscription); @Override void onSuccess(int statusCode, Header[] headers, byte[] responseBody); @Override void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error);  }
@Test public void onFailure() throws Exception { handler.onFailure(500, null, new String("hello").getBytes(), null); verify(listener).onSubscriptionChangeFailed(500, "hello"); }