Java Code Examples for retrofit2.converter.moshi.MoshiConverterFactory

The following examples show how to use retrofit2.converter.moshi.MoshiConverterFactory. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: auth   Source File: HttpModule.java    License: MIT License 6 votes vote down vote up
public RedditAuthApi getAuthApiService() {
    if (authService == null) {
        synchronized (this) {
            if (authService == null) {
                MoshiConverterFactory converterFactory =
                        MoshiConverterFactory.create(provideMoshi());
                authService =
                        new Retrofit.Builder()
                                .client(provideOkHttp())
                                .addConverterFactory(converterFactory)
                                .addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync())
                                .baseUrl("https://www.reddit.com/api/")
                                .build()
                                .create(RedditAuthApi.class);
            }
        }
    }
    return authService;
}
 
Example 2
Source Project: okuki   Source File: SwapiModule.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public SwapiModule(OkHttpClient okHttpClient, Moshi moshi) {
    final Retrofit swapiRetrofit = new Retrofit.Builder().baseUrl(Swapi.BASE_URL)
            .client(okHttpClient)
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .build();
    bind(Swapi.class).toInstance(swapiRetrofit.create(Swapi.class));
    final Retrofit searchRetrofit = new Retrofit.Builder().baseUrl(CustomSearch.BASE_URL)
            .client(okHttpClient)
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .build();
    bind(CustomSearch.class).toInstance(searchRetrofit.create(CustomSearch.class));
    bind(SwapiListDataManager.class).singletonInScope();
}
 
Example 3
Source Project: Iron   Source File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.action_settings) {
        Iron.chest().load(new Retrofit.Builder()
                .baseUrl("https://api.github.com")
                .addConverterFactory(MoshiConverterFactory.create())
                .build()
                .create(GitHubService.class)
                .listRepos("fabianterhorst"), Repo.class);
        return true;
    }

    return super.onOptionsItemSelected(item);
}
 
Example 4
Source Project: RxPalette   Source File: ImgurApi.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new ImgurApi with the specified clientId.
 *
 * @param clientId The client id.
 */
public ImgurApi(final String clientId) {
    OkHttpClient okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(new Interceptor() {
                @Override
                public Response intercept(Interceptor.Chain chain) throws IOException {
                    Request request = chain.request();
                    request = request.newBuilder().addHeader("Authorization", "Client-ID " + clientId).build();
                    return chain.proceed(request);
                }
            })
            .build();
    albumService = new Retrofit.Builder()
            .baseUrl("https://api.imgur.com/3/")
            .client(okHttpClient)
            .addConverterFactory(MoshiConverterFactory.create())
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .build()
            .create(AlbumService.class);
}
 
Example 5
Source Project: rides-java-sdk   Source File: OAuth2ServiceTest.java    License: MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    final HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);

    final OkHttpClient okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(loggingInterceptor)
            .build();

    final Moshi moshi = new Moshi.Builder().add(new OAuthScopesAdapter()).build();

    oAuth2Service = new Retrofit.Builder().baseUrl("http://localhost:" + wireMockRule.port())
            .client(okHttpClient)
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .build()
            .create(OAuth2Service.class);
}
 
Example 6
Source Project: influxdb-java   Source File: InfluxDBImpl.java    License: MIT License 6 votes vote down vote up
InfluxDBImpl(final String url, final String username, final String password, final OkHttpClient.Builder client,
    final InfluxDBService influxDBService, final JsonAdapter<QueryResult> adapter) {
  super();
  this.messagePack = false;
  this.hostName = parseHost(url);

  this.loggingInterceptor = new HttpLoggingInterceptor();
  setLogLevel(LOG_LEVEL);

  this.gzipRequestInterceptor = new GzipRequestInterceptor();
  OkHttpClient.Builder clonedBuilder = client.build().newBuilder()
          .addInterceptor(loggingInterceptor)
          .addInterceptor(gzipRequestInterceptor)
          .addInterceptor(new BasicAuthInterceptor(username, password));
  this.client = clonedBuilder.build();
  this.retrofit = new Retrofit.Builder().baseUrl(url)
      .client(this.client)
      .addConverterFactory(MoshiConverterFactory.create()).build();
  this.influxDBService = influxDBService;

  chunkProccesor = new JSONChunkProccesor(adapter);
}
 
Example 7
Source Project: appcenter-plugin   Source File: AppCenterServiceFactory.java    License: MIT License 5 votes vote down vote up
public AppCenterService createAppCenterService() {
    final HttpUrl baseHttpUrl = HttpUrl.get(baseUrl);

    final OkHttpClient.Builder builder = createHttpClientBuilder(baseHttpUrl)
        .addInterceptor(chain -> {
            final Request request = chain.request();

            final Headers newHeaders = request.headers().newBuilder()
                .add("Accept", "application/json")
                .add("Content-Type", "application/json")
                .add("X-API-Token", Secret.toString(apiToken))
                .build();

            final Request newRequest = request.newBuilder()
                .headers(newHeaders)
                .build();

            return chain.proceed(newRequest);
        });

    final Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(baseHttpUrl)
        .client(builder.build())
        .addConverterFactory(MoshiConverterFactory.create())
        .build();

    return retrofit.create(AppCenterService.class);
}
 
Example 8
Source Project: appcenter-plugin   Source File: AppCenterServiceFactory.java    License: MIT License 5 votes vote down vote up
public UploadService createUploadService(@Nonnull final String uploadUrl) {
    final HttpUrl httpUploadUrl = HttpUrl.get(uploadUrl);
    final HttpUrl baseUrl = HttpUrl.get(String.format("%1$s://%2$s/", httpUploadUrl.scheme(), httpUploadUrl.host()));

    final Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(baseUrl)
        .client(createHttpClientBuilder(baseUrl).build())
        .addConverterFactory(MoshiConverterFactory.create())
        .build();

    return retrofit.create(UploadService.class);
}
 
Example 9
public static Retrofit createRetrofitInstance() {
  return new Retrofit
      .Builder()
      .baseUrl(ConfigHelper.CHARGE_SERVER_URL)
      .addConverterFactory(MoshiConverterFactory.create())
      .build();
}
 
Example 10
public static List<Track> doTrackSearch(String releaseId) throws IOException {
    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(MusicBrainzService.API_URL)
            .client(getHttpClient())
            .addConverterFactory(MoshiConverterFactory.create())
            .build();

    MusicBrainzService service = retrofit.create(MusicBrainzService.class);

    Response<Release> releaseResponse = service.getRelease(releaseId).execute();
    Release release = releaseResponse.body();

    return release.media.get(0).tracks;
}
 
Example 11
Source Project: auth   Source File: HttpModule.java    License: MIT License 5 votes vote down vote up
public RedditApi getApiService() {
    if (apiService == null) {
        synchronized (this) {
            if (apiService == null) {
                OAuthAccountManager authenticator = app.getAccountManager();
                final OkHttpClient okHttpClient =
                        provideOkHttp()
                                .newBuilder()
                                // add authenticators only here to prevent deadlocks when
                                // (re-)authenticating
                                .authenticator(new RequestRetryAuthenticator(authenticator))
                                .addInterceptor(new RequestAuthInterceptor(authenticator))
                                .build();
                MoshiConverterFactory converterFactory =
                        MoshiConverterFactory.create(provideMoshi());
                apiService =
                        new Retrofit.Builder()
                                .client(okHttpClient)
                                .addConverterFactory(converterFactory)
                                .addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync())
                                .baseUrl("https://oauth.reddit.com/api/")
                                .build()
                                .create(RedditApi.class);
            }
        }
    }
    return apiService;
}
 
Example 12
Source Project: .samples   Source File: KitsuRestApi.java    License: GNU General Public License v3.0 5 votes vote down vote up
private KitsuRestApi() {
    final Retrofit retrofit = (new Retrofit.Builder())
            .baseUrl("https://kitsu.io/api/edge/")
            .addConverterFactory(MoshiConverterFactory.create())
            .build();
    kitsuApi = retrofit.create(KitsuSpecApi.class);
}
 
Example 13
Source Project: andela-crypto-app   Source File: ApiClient.java    License: Apache License 2.0 5 votes vote down vote up
public static Retrofit getClient() {
    if (retrofit == null) {
        retrofit = new Retrofit.Builder()
                .baseUrl(URLs.BASE_URL)
                .client(getOkClient())
                .addConverterFactory(MoshiConverterFactory.create(getMoshi()))
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build();
    }
    return retrofit;
}
 
Example 14
Source Project: droidconat-2016   Source File: ApiModule.java    License: Apache License 2.0 5 votes vote down vote up
@Provides @Singleton Retrofit provideRetrofit(OkHttpClient client, Moshi moshi, ApiEndpoint endpoint) {
    return new Retrofit.Builder()
            .client(client)
            .baseUrl(endpoint.url)
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
            .build();
}
 
Example 15
Source Project: hmftools   Source File: IclusionApiMain.java    License: GNU General Public License v3.0 5 votes vote down vote up
@NotNull
private static IclusionApi buildIclusionApi(@NotNull OkHttpClient httpClient, @NotNull String iClusionEndpoint) {
    MoshiConverterFactory moshiConverterFactory =
            MoshiConverterFactory.create(new Moshi.Builder().add(new IclusionResponseAdapter()).build());

    Retrofit retrofit = new Retrofit.Builder().baseUrl(iClusionEndpoint)
            .addConverterFactory(moshiConverterFactory)
            .addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync())
            .client(httpClient)
            .build();

    return retrofit.create(IclusionApi.class);
}
 
Example 16
Source Project: osstrich   Source File: MavenCentral.java    License: Apache License 2.0 5 votes vote down vote up
public MavenCentral() {
  Retrofit retrofit = new Retrofit.Builder()
      .baseUrl(HttpUrl.parse("https://search.maven.org/"))
      .addConverterFactory(MoshiConverterFactory.create())
      .build();
  this.mavenDotOrg = retrofit.create(MavenDotOrg.class);
}
 
Example 17
@Before
public void setUp() throws Exception {

    rideParameters = new RideParameters.Builder()
            .setProductId(PRODUCT_ID)
            .setDropoffLocation(valueOf(DROP_OFF_LATITUDE),
                    valueOf(DROP_OFF_LONGITUDE), DROP_OFF_NICKNAME, DROP_OFF_ADDRESS)
            .setPickupLocation(valueOf(PICKUP_LATITUDE), valueOf(PICKUP_LONGITUDE),
                    PICKUP_NICKNAME, PICKUP_ADDRESS)
            .build();

    Moshi moshi = new Moshi.Builder()
            .add(new BigDecimalAdapter())
            .build();

    okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(new HttpLoggingInterceptor()
                    .setLevel(HttpLoggingInterceptor.Level.BODY))
            .readTimeout(1, TimeUnit.SECONDS)
            .retryOnConnectionFailure(false)
            .build();

    countDownLatch = new CountDownLatch(2);

    service = new Retrofit.Builder()
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .callbackExecutor(new Executor() {
                @Override
                public void execute(@Nonnull Runnable command) {
                    command.run();
                    countDownLatch.countDown();
                }
            })
            .client(okHttpClient)
            .baseUrl("http://localhost:" + wireMockRule.port())
            .build()
            .create(RidesService.class);

    controller = new RideRequestButtonController(view, service, callback);
}
 
Example 18
Source Project: rides-java-sdk   Source File: AccessTokenAuthenticator.java    License: MIT License 5 votes vote down vote up
static OAuth2Service createOAuthService(String baseUrl) {
    final Moshi moshi = new Moshi.Builder().add(new OAuthScopesAdapter()).build();

    return new Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .build()
            .create(OAuth2Service.class);
}
 
Example 19
Source Project: rides-java-sdk   Source File: UberRidesApi.java    License: MIT License 5 votes vote down vote up
Retrofit createRetrofit(OkHttpClient client, Session session) {
    Moshi moshi = new Moshi.Builder().add(new BigDecimalAdapter()).build();

    return new Retrofit.Builder()
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .baseUrl(session.getAuthenticator().getSessionConfiguration().getEndpointHost())
            .client(client)
            .build();
}
 
Example 20
Source Project: rides-java-sdk   Source File: RidesServiceTest.java    License: MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Moshi moshi = new Moshi.Builder().add(new BigDecimalAdapter()).build();

    service = new Retrofit.Builder()
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .client(new OkHttpClient.Builder()
                    .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
                    .build())
            .baseUrl("http://localhost:" + wireMockRule.port())
            .build()
            .create(RidesService.class);
}
 
Example 21
Source Project: MovieGuide   Source File: NetworkModule.java    License: MIT License 5 votes vote down vote up
@Singleton
@Provides
Retrofit retrofit(OkHttpClient okHttpClient) {
    return new Retrofit
            .Builder()
            .baseUrl(BuildConfig.TMDB_BASE_URL)
            .addConverterFactory(MoshiConverterFactory.create())
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .client(okHttpClient)
            .build();
}
 
Example 22
Source Project: u2020-mvp   Source File: ApiModule.java    License: Apache License 2.0 5 votes vote down vote up
@Provides
@ApplicationScope
Retrofit provideRetrofit(HttpUrl baseUrl, @Named("Api") OkHttpClient client, Moshi moshi) {
    return new Retrofit.Builder() //
            .client(client) //
            .baseUrl(baseUrl) //
            .addConverterFactory(MoshiConverterFactory.create(moshi)) //
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) //
            .build();
}
 
Example 23
Source Project: u2020   Source File: ApiModule.java    License: Apache License 2.0 5 votes vote down vote up
@Provides @Singleton Retrofit provideRetrofit(HttpUrl baseUrl, @Named("Api") OkHttpClient client,
    Moshi moshi) {
  return new Retrofit.Builder() //
      .client(client) //
      .baseUrl(baseUrl) //
      .addConverterFactory(MoshiConverterFactory.create(moshi)) //
      .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) //
      .build();
}
 
Example 24
public static List<SearchResultRelease> doAlbumSearch(String artistId, String artistName)
        throws IOException {
    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(MusicBrainzService.API_URL)
            .client(getHttpClient())
            .addConverterFactory(MoshiConverterFactory.create())
            .build();

    MusicBrainzService service = retrofit.create(MusicBrainzService.class);

    Response<ReleaseList> releaseResponse = service.getReleases(artistId).execute();
    ReleaseList releases = releaseResponse.body();

    List<SearchResultRelease> result = new ArrayList<>();
    for (SearchResultRelease release : releases.releases) {
        if ((release.asin == null) || release.asin.isEmpty()) {
            continue;
        }
        if ((release.releaseEvents == null) || release.releaseEvents.isEmpty()) {
            continue;
        }

        boolean foundUsRelease = false;
        for (ReleaseEvent releaseEvent : release.releaseEvents) {
            if (releaseEvent.area == null) {
                continue;
            }
            if (!"United States".equals(releaseEvent.area.name)) {
                continue;
            }
            if ((releaseEvent.date == null) || releaseEvent.date.isEmpty()) {
                continue;
            }
            foundUsRelease = true;
            break;
        }

        if (!foundUsRelease) {
            continue;
        }

        // do we already have one?
        boolean isDuplicate = false;
        for (SearchResultRelease present : result) {
            if (present.asin.equals(release.asin)
                    || present.title.equals(release.title)) {
                isDuplicate = true;
                break;
            }
        }
        if (isDuplicate) {
            continue;
        }

        release.artist = artistName;
        result.add(release);
    }

    return result;
}
 
Example 25
Source Project: secrets-proxy   Source File: MSProxyClient.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Initial client setup to get TrustStore, OkHttpClient and Retrofit
 *
 * @param domain
 * @throws GeneralSecurityException
 */
public void setup(String domain) throws GeneralSecurityException {

  log.info("Initialize setup for MS Proxy Client");

  /* Get the clients configuration for MS*/
  Optional<ClientsAuthConfig.ClientsAuthDomain> clientAuth =
      clientsConfig.getAuthClients(SecretsConstants.MS + domain);

  Moshi moshi = new Moshi.Builder().add(new DateAdapter()).build();

  HttpLoggingInterceptor logIntcp = new HttpLoggingInterceptor(s -> log.info(s));
  logIntcp.setLevel(BASIC);

  TrustManager[] trustManagers = ProxyClientUtil.getTrustManagers(config);
  SSLSocketFactory socketFactory = ProxyClientUtil.getSocketfactory(trustManagers);

  int timeout = clientsConfig.getExpiresInSec();
  OkHttpClient okhttp =
      new OkHttpClient()
          .newBuilder()
          .sslSocketFactory(socketFactory, (X509TrustManager) trustManagers[0])
          .connectionSpecs(singletonList(ConnectionSpec.MODERN_TLS))
          .followSslRedirects(false)
          .retryOnConnectionFailure(true)
          .connectTimeout(timeout, SECONDS)
          .readTimeout(timeout, SECONDS)
          .writeTimeout(timeout, SECONDS)
          .addNetworkInterceptor(logIntcp)
          .addInterceptor(
              chain -> {
                Request.Builder reqBuilder =
                    chain.request().newBuilder().addHeader("Content-Type", "application/json");

                reqBuilder.addHeader(
                    SecretsConstants.MS_AUTH_HEADER, clientAuth.get().getAuth().getToken());

                return chain.proceed(reqBuilder.build());
              })
          .build();

  Retrofit retrofit =
      new Retrofit.Builder()
          .baseUrl(clientAuth.get().getUrl())
          .client(okhttp)
          .addConverterFactory(MoshiConverterFactory.create(moshi))
          .build();

  this.msProxy = retrofit.create(MSProxy.class);
  errResConverter = retrofit.responseBodyConverter(ErrorRes.class, new Annotation[0]);
}
 
Example 26
Source Project: secrets-proxy   Source File: TektonProxyClient.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Initial client setup to get TrustStore, OkHttpClient and Retrofit
 *
 * @param domain
 * @throws GeneralSecurityException
 */
public void setup(String domain) throws GeneralSecurityException {

  log.info("Initialize setup for Tekton Proxy Client");

  /* Get the configuration properties for Tekton only for given domain*/
  Optional<ClientsAuthConfig.ClientsAuthDomain> clientAuth = clientsConfig.getAuthClients(domain);

  Moshi moshi = new Moshi.Builder().add(new DateAdapter()).build();

  HttpLoggingInterceptor logIntcp = new HttpLoggingInterceptor(s -> log.info(s));
  logIntcp.setLevel(BASIC);

  TrustManager[] trustManagers = ProxyClientUtil.getTrustManagers(config);
  SSLSocketFactory socketFactory = ProxyClientUtil.getSocketfactory(trustManagers);

  int timeout = clientsConfig.getExpiresInSec();
  OkHttpClient okhttp =
      new OkHttpClient()
          .newBuilder()
          .sslSocketFactory(socketFactory, (X509TrustManager) trustManagers[0])
          .connectionSpecs(singletonList(ConnectionSpec.MODERN_TLS))
          .followSslRedirects(false)
          .retryOnConnectionFailure(true)
          .connectTimeout(timeout, SECONDS)
          .readTimeout(timeout, SECONDS)
          .writeTimeout(timeout, SECONDS)
          .addNetworkInterceptor(logIntcp)
          .addInterceptor(
              chain -> {
                Request.Builder reqBuilder =
                    chain.request().newBuilder().addHeader("Content-Type", "application/json");

                reqBuilder.addHeader(
                    SecretsConstants.TEKTON_AUTH_HEADER, clientAuth.get().getAuth().getToken());

                return chain.proceed(reqBuilder.build());
              })
          .build();

  Retrofit retrofit =
      new Retrofit.Builder()
          .baseUrl(clientAuth.get().getUrl())
          .client(okhttp)
          .addConverterFactory(MoshiConverterFactory.create(moshi))
          .build();

  this.tektonProxy = retrofit.create(TektonProxy.class);
  errResConverter = retrofit.responseBodyConverter(ErrorRes.class, new Annotation[0]);
}
 
Example 27
Source Project: android   Source File: DataModule.java    License: Apache License 2.0 4 votes vote down vote up
@Provides @Singleton Converter.Factory provideConverterFactory(Moshi moshi) {
  return MoshiConverterFactory.create(moshi);
}
 
Example 28
Source Project: influxdb-java   Source File: InfluxDBImpl.java    License: MIT License 4 votes vote down vote up
/**
 * Constructs a new {@code InfluxDBImpl}.
 *
 * @param url
 *          The InfluxDB server API URL
 * @param username
 *          The InfluxDB user name
 * @param password
 *          The InfluxDB user password
 * @param okHttpBuilder
 *          The OkHttp Client Builder
 * @param retrofitBuilder
 *          The Retrofit Builder
 * @param responseFormat
 *          The {@code ResponseFormat} to use for response from InfluxDB
 *          server
 */
public InfluxDBImpl(final String url, final String username, final String password,
                    final OkHttpClient.Builder okHttpBuilder, final Retrofit.Builder retrofitBuilder,
                    final ResponseFormat responseFormat) {
  this.messagePack = ResponseFormat.MSGPACK.equals(responseFormat);
  this.hostName = parseHost(url);

  this.loggingInterceptor = new HttpLoggingInterceptor();
  setLogLevel(LOG_LEVEL);

  this.gzipRequestInterceptor = new GzipRequestInterceptor();
  OkHttpClient.Builder clonedOkHttpBuilder = okHttpBuilder.build().newBuilder()
          .addInterceptor(loggingInterceptor)
          .addInterceptor(gzipRequestInterceptor);
  if (username != null && password != null) {
    clonedOkHttpBuilder.addInterceptor(new BasicAuthInterceptor(username, password));
  }
  Factory converterFactory = null;
  switch (responseFormat) {
  case MSGPACK:
    clonedOkHttpBuilder.addInterceptor(chain -> {
      Request request = chain.request().newBuilder().addHeader("Accept", APPLICATION_MSGPACK).build();
      return chain.proceed(request);
    });

    converterFactory = MessagePackConverterFactory.create();
    chunkProccesor = new MessagePackChunkProccesor();
    break;
  case JSON:
  default:
    converterFactory = MoshiConverterFactory.create();

    Moshi moshi = new Moshi.Builder().build();
    JsonAdapter<QueryResult> adapter = moshi.adapter(QueryResult.class);
    chunkProccesor = new JSONChunkProccesor(adapter);
    break;
  }

  this.client = clonedOkHttpBuilder.build();
  Retrofit.Builder clonedRetrofitBuilder = retrofitBuilder.baseUrl(url).build().newBuilder();
  this.retrofit = clonedRetrofitBuilder.client(this.client)
          .addConverterFactory(converterFactory).build();
  this.influxDBService = this.retrofit.create(InfluxDBService.class);

}