OkHttpClient throws exception after upgrading to OkHttp3
<p>I'm using following lines of code to add a default header to all of my requests sent using Retrofit2:</p>

<pre><code>private static OkHttpClient defaultHttpClient = new OkHttpClient();
static {
    defaultHttpClient.networkInterceptors().add(new Interceptor() {
        @Override
        public Response intercept(Chain chain) throws IOException {
            Request request = chain.request().newBuilder()
                    .addHeader("Accept", "Application/JSON").build();
            return chain.proceed(request);
        }
    });
}
</code></pre>

<p>After upgrading retrofit to beta-3 version, I had to upgrade OkHttp to OkHttp3 also (actually I just changed package names from okhttp to okhttp3, the library is included inside retrofit). After that I get exceptions from this line:</p>

<pre><code>defaultHttpClient.networkInterceptors().add(new Interceptor());
</code></pre>

<blockquote>
  <p>Caused by: java.lang.UnsupportedOperationException
                                                                    at java.util.Collections$UnmodifiableCollection.add(Collections.java:932)</p>
</blockquote>

<hr>

<blockquote>
  <p>Caused by: java.lang.ExceptionInInitializerError</p>
</blockquote>

<hr>

<p>What is the problem here?</p>