Here you can find the source of extractHostAddress(String uri)
public static String extractHostAddress(String uri) throws MalformedURLException
//package com.java2s; //License from project: Open Source License import java.net.MalformedURLException; import java.net.URL; public class Main { public static String extractHostAddress(String uri) throws MalformedURLException { URL url = new URL(uri); return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort(); }// www. j a va 2 s.c o m }