code: public InputStream receiveFile() throws SmackException, XMPPErrorException, InterruptedException {
          if (inputStream != null) {
              throw new IllegalStateException("Transfer already negotiated!");
          }
  
          try {
              inputStream = negotiateStream();
          }
          catch (XMPPErrorException e) {
              setException(e);
              throw e;
          }
  
          return inputStream;
      }
docs: Negotiates the stream method to transfer the file over and then returns
  the negotiated stream.
  
  @return The negotiated InputStream from which to read the data.
  @throws SmackException
  @throws XMPPErrorException If there is an error in the negotiation process an exception
  is thrown.
  @throws InterruptedException