title: RESTeasy client code for attaching a file
body: <p>I need to attach a file to my service end-point .
  I tested the functionality via POSTMAN ( chrome browser plugin to test rest service ) , it is working fine.</p>
  
  <p>But I need to test the same with  JUNIT .
  For that case I am using RESTeasy client .</p>
  
  <p>I was trying with this code : </p>
  
  <pre><code>    StringBuilder sb = new StringBuilder();
  
      BufferedReader br = new BufferedReader(new FileReader("C:/Temp/tempfile.txt"));
      try {
          String line = br.readLine();
          while (line != null) {
              sb.append(line);
              sb.append(System.lineSeparator());
              line = br.readLine();
          }
      }
      finally {
          br.close();
      }
  
      byte[] file = sb.toString().getBytes();
  
  Client client = ClientBuilder.newClient();
          Invocation.Builder builder = client.target(webTarget.getUri()
                  + "/attachment" ).request(MediaType.MULTIPART_FORM_DATA_TYPE);
  
          Response response = builder.post(Entity.entity(file, MediaType.MULTIPART_FORM_DATA), Response.class);
  </code></pre>
  
  <p>But I am getting an error : </p>
  
  <blockquote>
    <p><strong>org.apache.commons.fileupload.FileUploadException :</strong> the request was rejected because no multipart boundary was found</p>
  </blockquote>
  
  <p>Is there any solution for this ?</p>
  
  <p>Or can anybody give a sample RESTeasy rest client code to attach a file  ?</p>