code: public void waitUntilAllReceived(int timeout) throws ExternalFrameConfirmationException {
          try {
              byte flag = ExternalFrameConfirmationCheck.getConfirmation(ab, timeout);
              assert (flag == ExternalFrameHandler.CONFIRM_READING_DONE);
          } catch (TimeoutException ex) {
              throw new ExternalFrameConfirmationException("Timeout for confirmation exceeded!");
          } catch (InterruptedException e) {
              throw new ExternalFrameConfirmationException("Confirmation thread interrupted!");
          } catch (ExecutionException e) {
              throw new ExternalFrameConfirmationException("Confirmation failed!");
          }
      }
docs: This method ensures the application waits for all bytes to be received before continuing in the
  application's control flow.
  
  It has to be called at the end of reading.
  @param timeout timeout in seconds
  @throws ExternalFrameConfirmationException