Exemple #1
0
 /**
  * Get bout.
  *
  * @return Bout
  * @throws IOException If fails
  */
 public Bout bout() throws IOException {
   final Alias alias = new RqAlias(this.base, this).alias();
   final long number =
       Long.parseLong(new RqHeaders.Smart(new RqHeaders.Base(this)).single("X-Netbout-Bout"));
   final Bout bout;
   try {
     bout = alias.inbox().bout(number);
   } catch (final Inbox.BoutNotFoundException ex) {
     throw new HttpException(HttpURLConnection.HTTP_NOT_FOUND, ex);
   }
   if (!new Friends.Search(bout.friends()).exists(alias.name())) {
     throw new RsFailure(String.format("you're not in bout #%d", bout.number()));
   }
   return bout;
 }