Here you can find the source of getPort(InetSocketAddress socket)
public static String getPort(InetSocketAddress socket)
//package com.java2s; //License from project: Apache License import java.net.InetSocketAddress; public class Main { public static String getPort(InetSocketAddress socket) { return socket.getPort() + ""; }//from ww w . j a v a 2 s .c om }