// Path: app/src/main/java/com/ittianyu/pocenter/common/utils/UnsafeOkHttpUtils.java
// public class UnsafeOkHttpUtils {
//     /**
//      * don't verify certificate
//      * @return
//      */
//     public static OkHttpClient getClient() {
//         try {
//             // Create a trust manager that does not validate certificate chains
//             final TrustManager[] trustAllCerts = new TrustManager[] {
//                     new X509TrustManager() {
//                         @Override
//                         public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
//                         }
// 
//                         @Override
//                         public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
//                         }
// 
//                         @Override
//                         public java.security.cert.X509Certificate[] getAcceptedIssuers() {
//                             return new java.security.cert.X509Certificate[]{};
//                         }
//                     }
//             };
// 
//             // Install the all-trusting trust manager
//             final SSLContext sslContext = SSLContext.getInstance("SSL");
//             sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
//             // Create an ssl socket factory with our all-trusting manager
//             final javax.net.ssl.SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
// 
//             OkHttpClient.Builder builder = new OkHttpClient.Builder();
//             builder.sslSocketFactory(sslSocketFactory);
//             builder.hostnameVerifier(new HostnameVerifier() {
//                 @Override
//                 public boolean verify(String hostname, SSLSession session) {
//                     return true;
//                 }
//             });
// 
//             OkHttpClient okHttpClient = builder.build();
//             return okHttpClient;
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


import com.ittianyu.pocenter.common.utils.UnsafeOkHttpUtils;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import org.junit.Test;
import java.io.IOException;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;
import retrofit2.Retrofit;
import retrofit2.http.GET;
import retrofit2.http.Query;
import static org.junit.Assert.assertEquals;
package com.ittianyu.pocenter;






/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
        public static final String HOST = "po.ittianyu.com";
    public static final String URL_BASE = "https://" + HOST + "/";
//    public static final String HOST = "192.168.1.106";
//    public static final String URL_BASE = "http://" + HOST + "/pocenter/";

    interface RemoteApi {
        @GET("list")
        Observable<ResponseBody> getList(@Query("start") int start, @Query("count") int count,
                           @Query("type") int[] types, @Query("status") int status,
                           @Query(value = "keyword") String[] keywords);
    }


    @Test
    public void testSearch() throws IOException {
        RemoteApi remoteApi = new Retrofit.Builder()
                .baseUrl(URL_BASE)
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
//                .addConverterFactory(GsonConverterFactory.create())
// Path: app/src/main/java/com/ittianyu/pocenter/common/utils/UnsafeOkHttpUtils.java
// public class UnsafeOkHttpUtils {
//     /**
//      * don't verify certificate
//      * @return
//      */
//     public static OkHttpClient getClient() {
//         try {
//             // Create a trust manager that does not validate certificate chains
//             final TrustManager[] trustAllCerts = new TrustManager[] {
//                     new X509TrustManager() {
//                         @Override
//                         public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
//                         }
// 
//                         @Override
//                         public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
//                         }
// 
//                         @Override
//                         public java.security.cert.X509Certificate[] getAcceptedIssuers() {
//                             return new java.security.cert.X509Certificate[]{};
//                         }
//                     }
//             };
// 
//             // Install the all-trusting trust manager
//             final SSLContext sslContext = SSLContext.getInstance("SSL");
//             sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
//             // Create an ssl socket factory with our all-trusting manager
//             final javax.net.ssl.SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
// 
//             OkHttpClient.Builder builder = new OkHttpClient.Builder();
//             builder.sslSocketFactory(sslSocketFactory);
//             builder.hostnameVerifier(new HostnameVerifier() {
//                 @Override
//                 public boolean verify(String hostname, SSLSession session) {
//                     return true;
//                 }
//             });
// 
//             OkHttpClient okHttpClient = builder.build();
//             return okHttpClient;
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


// Path: app/src/test/java/com/ittianyu/pocenter/ExampleUnitTest.java
import com.ittianyu.pocenter.common.utils.UnsafeOkHttpUtils;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import org.junit.Test;
import java.io.IOException;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;
import retrofit2.Retrofit;
import retrofit2.http.GET;
import retrofit2.http.Query;
import static org.junit.Assert.assertEquals;

package com.ittianyu.pocenter;






/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
        public static final String HOST = "po.ittianyu.com";
    public static final String URL_BASE = "https://" + HOST + "/";
//    public static final String HOST = "192.168.1.106";
//    public static final String URL_BASE = "http://" + HOST + "/pocenter/";

    interface RemoteApi {
        @GET("list")
        Observable<ResponseBody> getList(@Query("start") int start, @Query("count") int count,
                           @Query("type") int[] types, @Query("status") int status,
                           @Query(value = "keyword") String[] keywords);
    }


    @Test
    public void testSearch() throws IOException {
        RemoteApi remoteApi = new Retrofit.Builder()
                .baseUrl(URL_BASE)
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
//                .addConverterFactory(GsonConverterFactory.create())
                .client(UnsafeOkHttpUtils.getClient())