判断socket是否处于连接状态:摘自jedis源码
return socket != null && socket.isBound() && !socket.isClosed()
&& socket.isConnected() && !socket.isInputShutdown()
&& !socket.isOutputShutdown();
关闭socket:摘自jedis源码
inputStream.close();
outputStream.close();
if (!socket.isClosed()) {
socket.close();
}