code: public static NewAppiumSessionPayload create(Capabilities caps) throws IOException {
          boolean forceMobileJSONWP =
                  ofNullable(caps.getCapability(FORCE_MJSONWP))
                  .map(o -> Boolean.class.isAssignableFrom(o.getClass()) && Boolean.class.cast(o))
                  .orElse(false);
  
          HashMap<String, ?> capabilityMap = new HashMap<>(caps.asMap());
          capabilityMap.remove(FORCE_MJSONWP);
          Map<String, ?> source = of(DESIRED_CAPABILITIES, capabilityMap);
          String json = new Json().toJson(source);
          return new NewAppiumSessionPayload(new StringReader(json), forceMobileJSONWP);
      }
docs: Creates instance of {@link NewAppiumSessionPayload}.
  
  @param caps capabilities to create a new session
  @return instance of {@link NewAppiumSessionPayload}