code: public static String encodeEndpoint(String uri, String operation) {
          StringBuilder buf=new StringBuilder();
          if (uri != null && !uri.trim().isEmpty()) {
              buf.append(uri);
          }
          if (operation != null && !operation.trim().isEmpty()) {
              buf.append('[');
              buf.append(operation);
              buf.append(']');
          }
          return buf.toString();
      }
docs: This method converts the supplied URI and optional operation
  into an endpoint descriptor.
  
  @param uri The URI
  @param operation The optional operation
  @return The endpoint descriptor