Is it possible with OkHttpClient
to limit the number of live connections? So if limit reached, no new connection is picked and established?
My app start
You could attempt to configure the maximum number of idle network connections by setting a ConnectionPool on your OkHttpClient.Builder
.
int maxConnections = 5;
int keepAliveDuration = 15000;
ConnectionPool cp = new ConnectionPool(maxConnections, keepAliveDuration, TimeUnit.MILLISECONDS);
new OkHttpClient.Builder()
.connectionPool(cp)
.build();