code: protected int getUnusedSerialNumber() {
          while(true) {
              int sid = (int)(Math.random() * Short.MAX_VALUE);
              if(! seenSIDs.contains(sid)) {
                  return sid;
              }
          }
      }
docs: Returns a random, but previously un-used serial
  number for use by a new stream