Here you can find the source of parseHostPort(String s)
public static InetSocketAddress parseHostPort(String s)
//package com.java2s; //License from project: Open Source License import java.net.InetSocketAddress; public class Main { public static final int DEFAULT_PORT = 13543; public static InetSocketAddress parseHostPort(String s) { String[] split = s.split(":", 2); int port = DEFAULT_PORT; if (split.length == 2) { try { port = Integer.parseInt(split[1]); } catch (NumberFormatException ex) { }/* ww w . jav a 2 s.com*/ } return new InetSocketAddress(split[0], port); } }