### Question:
OAuthResourceResponse extends OAuthClientResponse { public InputStream getBodyAsInputStream() { if (bodyRetrieved && inputStream == null) { throw new IllegalStateException("Cannot call getBodyAsInputStream() after getBody()"); } bodyRetrieved = true; return inputStream; } OAuthResourceResponse(); String getBody(); int getResponseCode(); String getContentType(); Map<String, List<String>> getHeaders(); InputStream getBodyAsInputStream();  }### Answer:
@Test public void allowBinaryResponseBody() throws OAuthProblemException, OAuthSystemException, IOException { final OAuthResourceResponse resp = createBinaryResponse(BINARY); final byte[] bytes = IOUtils.toByteArray(resp.getBodyAsInputStream()); assertArrayEquals(BINARY, bytes); }
@Test public void allowStringAsBinaryResponseBody() throws OAuthProblemException, OAuthSystemException, IOException { final OAuthResourceResponse resp = createBinaryResponse(STRING_BYTES); final byte[] bytes = IOUtils.toByteArray(resp.getBodyAsInputStream()); assertArrayEquals(STRING_BYTES, bytes); }