title: java.lang.NoSuchFieldError: INSTANCE in try to run WireMockServer
body: <p>I want to mock https calls in my Robolectric tests using wiremock, but when I run tests</p>
  
  <p>I guess the problem is about dependencies, but I have no idea how to resolve it. I tried to exclude httpclient from wiremock dependency, and use httpclient-android instead, but it doesn't work (I get <code>java.lang.ClassNotFoundException: org.apache.http.client.HttpClient</code>)</p>
  
  <p>I get the exception:</p>
  
  <pre><code>java.lang.ExceptionInInitializerError
      at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:958)
      at com.github.tomakehurst.wiremock.http.HttpClientFactory.createClient(HttpClientFactory.java:91)
      at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.&lt;init&gt;(ProxyResponseRenderer.java:59)
      at com.github.tomakehurst.wiremock.core.WireMockApp.buildStubRequestHandler(WireMockApp.java:148)
      at com.github.tomakehurst.wiremock.WireMockServer.&lt;init&gt;(WireMockServer.java:74)
      at com.github.tomakehurst.wiremock.WireMockServer.&lt;init&gt;(WireMockServer.java:119)
      at com.inaki.robolectric4.MainActivityTest.helloWorld(MainActivityTest.kt:21)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:546)
      at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:252)
      at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at org.robolectric.internal.bytecode.ShadowWrangler.classInitializing(ShadowWrangler.java:154)
      at org.robolectric.internal.bytecode.RobolectricInternals.classInitializing(RobolectricInternals.java:21)
      at org.apache.http.conn.ssl.SSLConnectionSocketFactory.&lt;clinit&gt;(SSLConnectionSocketFactory.java)
      at org.apache.http.impl.client.HttpClientBuilder.$$robo$$org_apache_http_impl_client_HttpClientBuilder$build(HttpClientBuilder.java:958)
      at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java)
      at com.github.tomakehurst.wiremock.http.HttpClientFactory.createClient(HttpClientFactory.java:91)
      at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.&lt;init&gt;(ProxyResponseRenderer.java:59)
      at com.github.tomakehurst.wiremock.core.WireMockApp.buildStubRequestHandler(WireMockApp.java:148)
      at com.github.tomakehurst.wiremock.WireMockServer.&lt;init&gt;(WireMockServer.java:74)
      at com.github.tomakehurst.wiremock.WireMockServer.&lt;init&gt;(WireMockServer.java:119)
      at com.inaki.robolectric4.MainActivityTest.helloWorld(MainActivityTest.kt:21)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      ... 11 more
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.robolectric.internal.bytecode.RobolectricInternals.performStaticInitialization(RobolectricInternals.java:61)
      at org.robolectric.internal.bytecode.ShadowWrangler.classInitializing(ShadowWrangler.java:151)
      ... 25 more
  Caused by: java.lang.NoSuchFieldError: INSTANCE
      at org.apache.http.conn.ssl.SSLConnectionSocketFactory.__staticInitializer__(SSLConnectionSocketFactory.java:146)
      ... 31 more
  </code></pre>
  
  <p>here is the test:</p>
  
  <pre><code>@RunWith(AndroidJUnit4::class)
  class MainActivityTest {
  
      @Test
      fun helloWorld() {
          val wireMockServer = WireMockServer()
          wireMockServer.stubFor(get("/v1/test")
                  .willReturn(aResponse().withStatus(200)))
          wireMockServer.start()
  
          ActivityScenario.launch(LoginActivity::class.java)
          onView(withId(R.id.hello)).check(matches(withText("Hello World!")))
      }
  }
  </code></pre>
  
  <p>here is the dependencies:</p>
  
  <pre><code>dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
      implementation 'com.android.support:appcompat-v7:28.0.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      implementation 'com.android.support:design:28.0.0'
      implementation 'com.android.support:support-annotations:28.0.0'
      implementation 'android.arch.lifecycle:extensions:1.1.1'
      testImplementation 'junit:junit:4.12'
      testImplementation 'androidx.test:rules:1.2.0'
      testImplementation 'androidx.test:runner:1.2.0'
      testImplementation ("com.github.tomakehurst:wiremock:2.25.1")
      testImplementation group: 'androidx.test.ext', name: 'junit', version: '1.1.1'
  
      testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      testImplementation ("org.robolectric:robolectric:4.3.1")
  }
  </code></pre>