code: private synchronized void closeAllAcceptedSockets() {
      for (int x = 0; x < socketList.size(); x++) {
        try {
          ((Socket) socketList.get(x)).close();
        } catch (Exception e) {
          // ignore for now
        }
      }
  
      // clear member variables
      socketMap.clear();
      socketList.clear();
    }
docs: Closes all the connected sockets in the List.