public boolean isConnected()
  {
    return socket != null
      && socket.isBound()
      && !socket.isClosed()
      && socket.isConnected()
      && !socket.isInputShutdown()
      && !socket.isOutputShutdown()
      && !failed;
  }