source: class RpcUtilsTest {
  
      @Test
      public void testDoOriginMatch() {
  
target:         Pair<String, String>[] matches = new Pair[]{
              new Pair("*", "*"),
              new Pair("file://", "*"),
              new Pair("localhost", "http://localhost"),
              new Pair("localhost:8080", "http://localhost:8080"),
              new Pair("http://localhost", "http://localhost:80"),
              new Pair("https://localhost", "http://localhost:443")
          };
  
          Pair<String, String>[] nonMatches = new Pair[]{
              new Pair(null, null),
              new Pair("*", null),
              new Pair("file://", "http://localhost:8080"),
              new Pair("http://localhost", "http://localhost:8080"),
              new Pair("http://host", "http://localhost")
          };
  
          for (int i = 0; i < matches.length; i++) {
              Pair<String, String> pair = matches[i];
              System.out.println("asserting match: " + pair);
              assertTrue(RpcUtils.doOriginsMatch(pair.getElement1(), pair.getElement2()));
              assertTrue(RpcUtils.doOriginsMatch(pair.getElement2(), pair.getElement1()));
  
          }
          for (int i = 0; i < nonMatches.length; i++) {
              Pair<String, String> pair = nonMatches[i];
              System.out.println("asserting not match: " + pair);
              assertFalse(RpcUtils.doOriginsMatch(pair.getElement1(), pair.getElement2()));
              assertFalse(RpcUtils.doOriginsMatch(pair.getElement2(), pair.getElement1()));
          }
      }
  
  }