public static Buffer expectToken(final Buffer buffer) throws IndexOutOfBoundsException, IOException,
            SipParseException {
        final Buffer token = consumeToken(buffer);
        if (token == null) {
            throw new SipParseException(buffer.getReaderIndex(), "Expected TOKEN");
        }
        return token;
    }
public static Buffer expectToken ( final Buffer buffer ) throws IndexOutOfBoundsException , IOException , SipParseException { final Buffer token = consumeToken ( buffer ) ; if ( token == null ) { throw new SipParseException ( buffer . getReaderIndex ( ) , "Expected TOKEN" ) ; } return token ; }
Expects a token, which according to RFC3261 section 25.1 Basic Rules is:

token = 1*(alphanum / "-" / "." / "!" / "%" / "*" / "_" / "+" / "`" / "'"
/ "~" )

@param buffer
@return the buffer containing the expected token
@throws IOException
@throws IndexOutOfBoundsException
@throws SipParseException
in case there is no token