title: Unable to receive data from HttpClient call
body: <p>I'm trying to send a POST request through <code>HttpClient</code> to a Resource but it seems that there is no data to consume..</p>
  
  <p>I've a filter before the call is passed to that resource to verify signature and validate it, but nothing happens after that.. no data is received at the resource end which triggers appropriate exception
  here is my code to make the request</p>
  
  <pre><code>CloseableHttpResponse response = null;
  StringBuilder result = new StringBuilder();
  try {
  CloseableHttpClient client=HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
  HttpPost request = new HttpPost(API_BASE_URL + "/generateToken");
  //Set Headers
  request.setHeader("Accept", "application/json");
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  request.addHeader("Signature",URLEncoder.encode(generateSignature(),"UTF-8"));
  request.addHeader("Expires", String.valueOf(timestamp));
  request.addHeader("AccessKey", URLEncoder.encode(accessKey, "UTF-8"));
  
  //Add Paramets
  request.setEntity(new UrlEncodedFormEntity(parameters));
  
  //Sends Request
  response = client.execute(request);
  
  //Read From Response
  BufferedReader reader;
  InputStream inputStream = response.getEntity().getContent();
  reader = new BufferedReader(new InputStreamReader(inputStream));
  String inputLine;
  while ((inputLine = reader.readLine()) != null) {
  result.append(inputLine);
  }
  EntityUtils.consume(response.getEntity());
  </code></pre>
  
  <p>I'm sending <code>login</code> and <code>pass</code> as List<code>&lt;NameVaulePair&gt;</code> parameters</p>
  
  <p>My Resource code</p>
  
  <pre><code>@POST
      @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
      @Produces(MediaType.APPLICATION_JSON)
      public Response getToken(@FormParam("login") String slashtagOrEmail,
              @FormParam("pass") String password) {
          String token = null;
          try {
              token = publisherService.authenticate(slashtagOrEmail, password);
              return Response.ok().entity(token).build();
          } catch (RemoteException | EmailNotFoundException | UsernameNotFoundException | UnknownLoginException | IncorrectPasswordException | AccountNotConfirmedException ex) {
              return Response.status(Response.Status.UNAUTHORIZED).entity(ex.toString()).build();
          }
  
      }
  </code></pre>
  
  <p>After I make the request I get <code>UsernameNotFoundException</code> which is basically for empty <code>slashtagOrEmail</code> variable </p>
  
  <p>The JUnit Test for <code>publisherService.authenticate()</code> function gives proper result, I don't see where I'm making mistake(s).  </p>
  
  <p><i>PS:This is my very first question on SO, please help me to frame questions better, Thanks Again</i></p>