Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1.  
  2.  
  3. public class ApiFactory {
  4.  
  5.  
  6.     private static final int CONNECT_TIMEOUT=15;
  7.     private static final int WRITE_TIMEOUT=60;
  8.     private static final int TIMEOUT=60;
  9.  
  10.     private static final OkHttpClient client=new OkHttpClient.Builder()
  11.             .connectTimeout(CONNECT_TIMEOUT,TimeUnit.SECONDS)
  12.             .writeTimeout(WRITE_TIMEOUT,TimeUnit.SECONDS)
  13.             .readTimeout(TIMEOUT,TimeUnit.SECONDS).build();
  14.  
  15.  
  16.     @NonNull
  17.     public static MyMIIT getMyMIIT(){
  18.         return getRetrofit().create(MyMIIT.class);
  19.     }
  20.  
  21.  
  22.     @NonNull
  23.     private static Retrofit getRetrofit(){
  24.         return new Retrofit.Builder()
  25.                 .baseUrl("my.miit.ru/")
  26.                 .client(client)
  27.                 //Еще одну строку лол
  28.                 .build();
  29.     }
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement