code: private void initConnection() throws IOException, InterruptedException {
          compressionHandler = null;
  
          // Set the reader and writer instance variables
          initReaderAndWriter();
  
          int availableReaderWriterSemaphorePermits = readerWriterSemaphore.availablePermits();
          if (availableReaderWriterSemaphorePermits < 2) {
              Object[] logObjects = new Object[] {
                              this,
                              availableReaderWriterSemaphorePermits,
              };
              LOGGER.log(Level.FINE, "Not every reader/writer threads where terminated on connection re-initializtion of {0}. Available permits {1}", logObjects);
          }
          readerWriterSemaphore.acquire(2);
          // Start the writer thread. This will open an XMPP stream to the server
          packetWriter.init();
          // Start the reader thread. The startup() method will block until we
          // get an opening stream packet back from server
          packetReader.init();
      }
docs: Initializes the connection by creating a stanza reader and writer and opening a
  XMPP stream to the server.
  
  @throws XMPPException if establishing a connection to the server fails.
  @throws SmackException if the server fails to respond back or if there is anther error.
  @throws IOException
  @throws InterruptedException