public static ServiceURI create(String uriStr) {
        requireNonNull(uriStr, "service uri string is null");

        if (uriStr.contains("[") && uriStr.contains("]")) {
            // deal with ipv6 address
            Splitter splitter = Splitter.on(CharMatcher.anyOf(",;"));
            List<String> hosts = splitter.splitToList(uriStr);

            if (hosts.size() > 1) {
                // deal with multi ipv6 hosts
                String firstHost = hosts.get(0);
                String lastHost = hosts.get(hosts.size() - 1);
                boolean hasPath = lastHost.contains("/");
                String path = hasPath ? lastHost.substring(lastHost.indexOf("/")) : "";
                firstHost += path;

                URI uri = URI.create(firstHost);
                ServiceURI serviceURI = create(uri);

                List<String> multiHosts = new ArrayList<>();
                multiHosts.add(serviceURI.getServiceHosts()[0]);
                multiHosts.addAll(hosts.subList(1, hosts.size()));
                multiHosts = multiHosts
                        .stream()
                        .map(host -> validateHostName(serviceURI.getServiceName(), serviceURI.getServiceInfos(), host))
                        .collect(Collectors.toList());
                return new ServiceURI(
                        serviceURI.getServiceName(),
                        serviceURI.getServiceInfos(),
                        serviceURI.getServiceUser(),
                        multiHosts.toArray(new String[multiHosts.size()]),
                        serviceURI.getServicePath(),
                        serviceURI.getUri());
            }
        }

        // a service uri first should be a valid java.net.URI
        URI uri = URI.create(uriStr);

        return create(uri);
    }
@Test(expectedExceptions = NullPointerException.class)
    public void testNullServiceUriInstance() {
        ServiceURI.create((URI) null);
    }