Here you can find the source of createURI(String uri)
public static final URI createURI(String uri)
//package com.java2s; //License from project: Apache License import java.net.URI; public class Main { public static final URI createURI(String uri) { return URI.create("//" + parseCorrectURI(uri)); }//from w ww . jav a 2 s. co m private static final String parseCorrectURI(String uri) { String[] parts = uri.split(":"); if (parts.length - 1 >= 3) { String port = parts[parts.length - 1]; uri = "[" + uri.replace(":" + port, "") + "]:" + port; } return uri; } }