private static boolean isRequestTo(HttpRequest request, String uri) {
    URI decodedUri;
    try {
      decodedUri = new URI(request.getUri());
    } catch (URISyntaxException e) {
      return false;
    }

    return HttpVersion.HTTP_1_1.equals(request.getProtocolVersion())
        && USER_AGENT.equals(request.getHeader(HttpHeaders.Names.USER_AGENT))
        && HttpMethod.POST.equals(request.getMethod())
        && uri.equals(decodedUri.getPath());
  }
 private static boolean isResponseWithCode(HttpResponse response, HttpResponseStatus status) {
   return HttpVersion.HTTP_1_1.equals(response.getProtocolVersion())
       && status.equals(response.getStatus());
 }