public Expectation[] retrieveAsExpectations(HttpRequest httpRequest, HttpResponse httpResponse) {
Expectation[] expectations = expectationSerializer.deserializeArray(apacheHttpClient.sendPUTRequest(uriBase, "/retrieve", (httpRequest != null ? httpRequestSerializer.serialize(httpRequest) : "")));
if (httpResponse != null) {
List<Expectation> matchingExpectations = new ArrayList<Expectation>();
HttpResponseMatcher httpResponseMatcher = new HttpResponseMatcher(httpResponse);
for (Expectation expectation : expectations) {
if (httpResponseMatcher.matches(expectation.getHttpResponse(false))) {
matchingExpectations.add(expectation);
}
}
expectations = matchingExpectations.toArray(new Expectation[matchingExpectations.size()]);
}