Here you can find the source of getSocket(String host, int port)
public static Socket getSocket(String host, int port) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.net.Socket; public class Main { public static Socket getSocket(String host, int port) throws IOException { if (host == null || port == -1) throw new IllegalArgumentException("Missing required arguments: host and/or port"); return new Socket(host, port); }/*from ww w .java 2s .co m*/ }