private void notifyFriendsThatUserWentOffline(com.is.chatmultimedia.models.User user) {
    new Runnable() {

      @Override
      public void run() {
        ObjectOutputStream output;
        Collection<Friend> friends = user.getFriends();
        User serverUser;
        UserWentOfflineMessage message = new UserWentOfflineMessage(user.getUsername());
        for (Friend it : friends) {
          try {
            if (it.isOnline()) {
              serverUser = userManager.getUserByUsername(it.getUsername());
              if (serverUser != null) { // friend is online, notify him
                output = serverUser.getConnection().getOutputStream();
                output.writeObject(message);
                output.flush();
              }
            }
          }
          catch (IOException e) {
          }
        }
      }
    }.run();
  }