Here you can find the source of isConnected(Socket socket)
public static boolean isConnected(Socket socket)
//package com.java2s; //License from project: Open Source License import java.net.Socket; public class Main { public static boolean isConnected(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }//from w w w. j a v a 2 s . c om }