code: private static List<ServerPort> resolveDistinctPorts(List<ServerPort> ports) {
          final List<ServerPort> distinctPorts = new ArrayList<>();
          for (final ServerPort p : ports) {
              boolean found = false;
              // Do not check the port number 0 because a user may want his or her server to be bound
              // on multiple arbitrary ports.
              if (p.localAddress().getPort() > 0) {
                  for (int i = 0; i < distinctPorts.size(); i++) {
                      final ServerPort port = distinctPorts.get(i);
                      if (port.localAddress().equals(p.localAddress())) {
                          final ServerPort merged =
                                  new ServerPort(port.localAddress(),
                                                 Sets.union(port.protocols(), p.protocols()));
                          distinctPorts.set(i, merged);
                          found = true;
                          break;
                      }
                  }
              }
              if (!found) {
                  distinctPorts.add(p);
              }
          }
          return Collections.unmodifiableList(distinctPorts);
      }
docs: Returns a list of {@link ServerPort}s which consists of distinct port numbers except for the port
  {@code 0}. If there are the same port numbers with different {@link SessionProtocol}s,
  their {@link SessionProtocol}s will be merged into a single {@link ServerPort} instance.
  The returned list is sorted as the same order of the specified {@code ports}.