Here you can find the source of getInetSocketAddress(String endpoint)
Parameter | Description |
---|---|
endpoint | a String in (host:port) format |
public static InetSocketAddress getInetSocketAddress(String endpoint)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.net.InetSocketAddress; public class Main { /**// ww w . j av a2 s. com * Convert an endpoint from String (host:port) to InetSocketAddress * * @param endpoint a String in (host:port) format * @return an InetSocketAddress representing the endpoint */ public static InetSocketAddress getInetSocketAddress(String endpoint) { String[] array = endpoint.split(":"); return new InetSocketAddress(array[0], Integer.parseInt(array[1])); } }