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 MultipartBody.Builder builder = new MultipartBody.Builder();
  
              for (final MultipartContent.MultipartPart mpe : ((MultipartContent) body).parts()) {
                  if (mpe.getFileName() == null) {
                      builder.addFormDataPart(mpe.getFieldName(), (String) mpe.getContent());
                  } else {
                      builder.addFormDataPart(
                          mpe.getFieldName(),
                          mpe.getFileName(),
                          create(parse(mpe.getContentType()), encode(config, mpe.getContentType(), mpe.getContent()))
                      );
                  }
              }
  
              final Buffer buffer = new Buffer();
              MultipartBody multipartBody = builder.build();
              multipartBody.writeTo(buffer);
  
              request.setContentType("multipart/form-data; boundary=" + multipartBody.boundary());
  
              ts.toServer(buffer.inputStream());
  
          } catch (IOException e) {
              e.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