code: public static void multipart(final ChainedHttpConfig config, final ToServer ts) {
          try {
              final ChainedHttpConfig.ChainedRequest request = config.getChainedRequest();
  
              final Object body = request.actualBody();
              if (!(body instanceof MultipartContent)) {
                  throw new IllegalArgumentException("Multipart body content must be MultipartContent.");
              }
  
              final String contentType = request.actualContentType();
              if (!(contentType.equals(MULTIPART_FORMDATA.getAt(0)) || contentType.equals(MULTIPART_MIXED.getAt(0)))) {
                  throw new IllegalArgumentException("Multipart body content must be multipart/form-data.");
              }
  
              final MimeMultipart mimeMultipart = new MimeMultipart();
  
              for (final MultipartContent.MultipartPart mpe : ((MultipartContent) body).parts()) {
                  mimeMultipart.addBodyPart(part(config, mpe));
              }
  
              request.setContentType(mimeMultipart.getContentType());
  
              final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
              mimeMultipart.writeTo(bytesOut);
  
              ts.toServer(new ByteArrayInputStream(bytesOut.toByteArray()));
  
          } catch (IOException | MessagingException ioe) {
              ioe.printStackTrace();
          }
      }
docs: Encodes multipart/form-data where the body content must be an instance of the {@link MultipartContent} class. Individual parts will be
  encoded using the encoders available to the {@link ChainedHttpConfig} object.
  
  @param config the chained configuration object
  @param ts     the server adapter