public static String encodeParameters(
     List<HttpParameter> httpParams, String splitter, boolean quot) {
   StringBuffer buf = new StringBuffer();
   for (HttpParameter param : httpParams) {
     if (!param.isFile()) {
       if (buf.length() != 0) {
         if (quot) {
           buf.append("\"");
         }
         buf.append(splitter);
       }
       buf.append(encode(param.getName())).append("=");
       if (quot) {
         buf.append("\"");
       }
       buf.append(encode(param.getValue()));
     }
   }
   if (buf.length() != 0) {
     if (quot) {
       buf.append("\"");
     }
   }
   return buf.toString();
 }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;

    TwitterStreamImpl that = (TwitterStreamImpl) o;

    if (handler != null ? !handler.equals(that.handler) : that.handler != null) return false;
    if (http != null ? !http.equals(that.http) : that.http != null) return false;
    if (lifeCycleListeners != null
        ? !lifeCycleListeners.equals(that.lifeCycleListeners)
        : that.lifeCycleListeners != null) return false;
    if (rawStreamListeners != null
        ? !rawStreamListeners.equals(that.rawStreamListeners)
        : that.rawStreamListeners != null) return false;
    if (siteStreamsListeners != null
        ? !siteStreamsListeners.equals(that.siteStreamsListeners)
        : that.siteStreamsListeners != null) return false;
    if (stallWarningsGetParam != null
        ? !stallWarningsGetParam.equals(that.stallWarningsGetParam)
        : that.stallWarningsGetParam != null) return false;
    if (stallWarningsParam != null
        ? !stallWarningsParam.equals(that.stallWarningsParam)
        : that.stallWarningsParam != null) return false;
    if (statusListeners != null
        ? !statusListeners.equals(that.statusListeners)
        : that.statusListeners != null) return false;
    if (userStreamListeners != null
        ? !userStreamListeners.equals(that.userStreamListeners)
        : that.userStreamListeners != null) return false;

    return true;
  }
 @Override
 public int hashCode() {
   int result = super.hashCode();
   result = 31 * result + (http != null ? http.hashCode() : 0);
   result = 31 * result + (lifeCycleListeners != null ? lifeCycleListeners.hashCode() : 0);
   result = 31 * result + (handler != null ? handler.hashCode() : 0);
   result = 31 * result + (stallWarningsGetParam != null ? stallWarningsGetParam.hashCode() : 0);
   result = 31 * result + (stallWarningsParam != null ? stallWarningsParam.hashCode() : 0);
   result = 31 * result + (userStreamListeners != null ? userStreamListeners.hashCode() : 0);
   result = 31 * result + (statusListeners != null ? statusListeners.hashCode() : 0);
   result = 31 * result + (siteStreamsListeners != null ? siteStreamsListeners.hashCode() : 0);
   result = 31 * result + (rawStreamListeners != null ? rawStreamListeners.hashCode() : 0);
   return result;
 }
  /*package*/ String generateAuthorizationHeader(
      String method,
      String url,
      HttpParameter[] params,
      String nonce,
      String timestamp,
      OAuthToken otoken) {
    if (null == params) {
      params = new HttpParameter[0];
    }
    List<HttpParameter> oauthHeaderParams = new ArrayList<HttpParameter>(5);
    oauthHeaderParams.add(new HttpParameter("oauth_consumer_key", consumerKey));
    oauthHeaderParams.add(OAUTH_SIGNATURE_METHOD);
    oauthHeaderParams.add(new HttpParameter("oauth_timestamp", timestamp));
    oauthHeaderParams.add(new HttpParameter("oauth_nonce", nonce));
    oauthHeaderParams.add(new HttpParameter("oauth_version", "1.0"));
    if (null != otoken) {
      oauthHeaderParams.add(new HttpParameter("oauth_token", otoken.getToken()));
    }
    List<HttpParameter> signatureBaseParams =
        new ArrayList<HttpParameter>(oauthHeaderParams.size() + params.length);
    signatureBaseParams.addAll(oauthHeaderParams);
    if (!HttpParameter.containsFile(params)) {
      signatureBaseParams.addAll(toParamList(params));
    }
    parseGetParameters(url, signatureBaseParams);
    StringBuffer base =
        new StringBuffer(method).append("&").append(encode(constructRequestURL(url))).append("&");
    base.append(encode(normalizeRequestParameters(signatureBaseParams)));
    String oauthBaseString = base.toString();
    logger.debug("OAuth base string: ", oauthBaseString);
    String signature = generateSignature(oauthBaseString, otoken);
    logger.debug("OAuth signature: ", signature);

    oauthHeaderParams.add(new HttpParameter("oauth_signature", signature));
    return "OAuth " + encodeParameters(oauthHeaderParams, ",", true);
  }