code: private static Capabilities dropCapabilities(Capabilities capabilities) {
      if (capabilities == null) {
        return new ImmutableCapabilities();
      }
  
      MutableCapabilities caps;
  
      if (isLegacy(capabilities)) {
        final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
        caps = new MutableCapabilities(
            Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
      } else {
        caps = new MutableCapabilities(capabilities);
      }
  
      // Ensure that the proxy is in a state fit to be sent to the extension
      Proxy proxy = Proxy.extractFrom(capabilities);
      if (proxy != null) {
        caps.setCapability(PROXY, proxy);
      }
  
      return caps;
    }
docs: Drops capabilities that we shouldn't send over the wire.
  
  Used for capabilities which aren't BeanToJson-convertable, and are only used by the local
  launcher.