public void testUri() throws Exception {
UriBuilder builder = new UriBuilderImpl();
builder.scheme("http").host("localhost").port(80).segment("path1", "path2");
builder.matrixParam("mat1", "{var1}", "v2");
builder.fragment("fragment");
URI uri = URI.create("http://iamlegend@remotehost:90/path3;mat2=v1/path4#this%20fragment");
builder.uri(uri);
String uriStr = builder.build().toString();
assertEquals("http://iamlegend@remotehost:90/path3;mat2=v1/path4#this%20fragment", uriStr);