// Path: renovate/src/main/java/renovate/HttpException.java
// public class HttpException extends RuntimeException {
//   private static String getMessage(Response<?> response) {
//     checkNotNull(response, "response == null");
//     return "HTTP " + response.code() + " " + response.message();
//   }
// 
//   private final int code;
//   private final String message;
//   private final transient Response<?> response;
// 
//   public HttpException(Response<?> response) {
//     super(getMessage(response));
//     this.code = response.code();
//     this.message = response.message();
//     this.response = response;
//   }
// 
//   /** HTTP status code. */
//   public int code() {
//     return code;
//   }
// 
//   /** HTTP status message. */
//   public String message() {
//     return message;
//   }
// 
//   /**
//    * The full HTTP response. This may be null if the exception was serialized.
//    */
//   public Response<?> response() {
//     return response;
//   }
// }
// 
// Path: renovate/src/main/java/renovate/Response.java
// public final class Response<T> {
//   private final okhttp3.Response rawResponse;
//   private final T body;
//   private final ResponseBody errorBody;
// 
//   private Response(okhttp3.Response rawResponse, T body, ResponseBody errorBody) {
//     this.rawResponse = rawResponse;
//     this.body = body;
//     this.errorBody = errorBody;
//   }
// 
//   public static <T> Response<T> success(T body) {
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, Headers headers) {
//     if (headers == null) throw new NullPointerException("headers == null");
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .headers(headers)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, okhttp3.Response rawResponse) {
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (!rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse must be successful response");
//     }
//     return new Response<>(rawResponse, body, null);
//   }
// 
//   public static <T> Response<T> error(int code, ResponseBody body) {
//     if (code < 400) throw new IllegalArgumentException("code < 400: " + code);
//     return error(body, new okhttp3.Response.Builder() //
//         .code(code)
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> error(ResponseBody body, okhttp3.Response rawResponse) {
//     if (body == null) throw new NullPointerException("body == null");
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse should not be successful response");
//     }
//     return new Response<>(rawResponse, null, body);
//   }
// 
//   public okhttp3.Response raw() {
//     return rawResponse;
//   }
// 
//   public int code() {
//     return rawResponse.code();
//   }
// 
//   public String message() {
//     return rawResponse.message();
//   }
// 
//   public Headers headers() {
//     return rawResponse.headers();
//   }
// 
//   public boolean isSuccessful() {
//     return rawResponse.isSuccessful();
//   }
// 
//   public T body() {
//     return body;
//   }
// 
//   public ResponseBody errorBody() {
//     return errorBody;
//   }
// 
//   @Override public String toString() {
//     return rawResponse.toString();
//   }
// }


import renovate.HttpException;
import renovate.Response;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.exceptions.*;
import rx.plugins.RxJavaHooks;
/*
 * Copyright 2016 jeasonlzy(廖子尧)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package renovate.rxjava.subscribe;



/**
 * ================================================
 * 作    者：jeasonlzy（廖子尧）Github地址：https://github.com/jeasonlzy
 * 版    本：1.0
 * 创建日期：16/9/11
 * 描    述：
 * 修订历史：
 * ================================================
 */
public final class BodyOnSubscribe<T> implements OnSubscribe<T> {
    private final OnSubscribe<Response<T>> upstream;

// Path: renovate/src/main/java/renovate/HttpException.java
// public class HttpException extends RuntimeException {
//   private static String getMessage(Response<?> response) {
//     checkNotNull(response, "response == null");
//     return "HTTP " + response.code() + " " + response.message();
//   }
// 
//   private final int code;
//   private final String message;
//   private final transient Response<?> response;
// 
//   public HttpException(Response<?> response) {
//     super(getMessage(response));
//     this.code = response.code();
//     this.message = response.message();
//     this.response = response;
//   }
// 
//   /** HTTP status code. */
//   public int code() {
//     return code;
//   }
// 
//   /** HTTP status message. */
//   public String message() {
//     return message;
//   }
// 
//   /**
//    * The full HTTP response. This may be null if the exception was serialized.
//    */
//   public Response<?> response() {
//     return response;
//   }
// }
// 
// Path: renovate/src/main/java/renovate/Response.java
// public final class Response<T> {
//   private final okhttp3.Response rawResponse;
//   private final T body;
//   private final ResponseBody errorBody;
// 
//   private Response(okhttp3.Response rawResponse, T body, ResponseBody errorBody) {
//     this.rawResponse = rawResponse;
//     this.body = body;
//     this.errorBody = errorBody;
//   }
// 
//   public static <T> Response<T> success(T body) {
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, Headers headers) {
//     if (headers == null) throw new NullPointerException("headers == null");
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .headers(headers)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, okhttp3.Response rawResponse) {
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (!rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse must be successful response");
//     }
//     return new Response<>(rawResponse, body, null);
//   }
// 
//   public static <T> Response<T> error(int code, ResponseBody body) {
//     if (code < 400) throw new IllegalArgumentException("code < 400: " + code);
//     return error(body, new okhttp3.Response.Builder() //
//         .code(code)
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> error(ResponseBody body, okhttp3.Response rawResponse) {
//     if (body == null) throw new NullPointerException("body == null");
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse should not be successful response");
//     }
//     return new Response<>(rawResponse, null, body);
//   }
// 
//   public okhttp3.Response raw() {
//     return rawResponse;
//   }
// 
//   public int code() {
//     return rawResponse.code();
//   }
// 
//   public String message() {
//     return rawResponse.message();
//   }
// 
//   public Headers headers() {
//     return rawResponse.headers();
//   }
// 
//   public boolean isSuccessful() {
//     return rawResponse.isSuccessful();
//   }
// 
//   public T body() {
//     return body;
//   }
// 
//   public ResponseBody errorBody() {
//     return errorBody;
//   }
// 
//   @Override public String toString() {
//     return rawResponse.toString();
//   }
// }


// Path: rx-renovate/src/main/java/renovate/rxjava/subscribe/BodyOnSubscribe.java
import renovate.HttpException;
import renovate.Response;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.exceptions.*;
import rx.plugins.RxJavaHooks;

/*
 * Copyright 2016 jeasonlzy(廖子尧)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package renovate.rxjava.subscribe;



/**
 * ================================================
 * 作    者：jeasonlzy（廖子尧）Github地址：https://github.com/jeasonlzy
 * 版    本：1.0
 * 创建日期：16/9/11
 * 描    述：
 * 修订历史：
 * ================================================
 */
public final class BodyOnSubscribe<T> implements OnSubscribe<T> {
    private final OnSubscribe<Response<T>> upstream;

    public BodyOnSubscribe(OnSubscribe<Response<T>> upstream) {