# Writing a MockWebServer test for GET("joke.json") fails on Android 9 and above

**URL:** <https://forums.kodeco.com/t/writing-a-mockwebserver-test-for-get-joke-json-fails-on-android-9-and-above/186166>\
**Category:** Android Test-Driven Development by Tutorials\
**Created:** [April 11, 2023, 9:46pm UTC](https://forums.kodeco.com/t/writing-a-mockwebserver-test-for-get-joke-json-fails-on-android-9-and-above/186166 "2023-04-11T21:46:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![numan.kacar](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/numan.kacar/32/108713_2.png) [@numan.kacar](https://forums.kodeco.com/u/numan.kacar)\
**Post date:** [April 11, 2023, 9:46pm UTC](https://forums.kodeco.com/t/writing-a-mockwebserver-test-for-get-joke-json-fails-on-android-9-and-above/186166/1 "2023-04-11T21:46:10Z")

</div>

Dear Experts,

There is a problem in “Writing a MockWebServer test” section in Chapter 10 - Testing Network Layer.

When we try to run mock server test with GET(“joke.json”) URL it gives error below because CLEAR\_TEXT communication it’s not permitted in API Level 28 and above → [Details](https://developer.android.com/about/versions/pie/android-9.0-changes-28#tls-enabled)

**How To Reproduce Issue**  
You can run test on an emulator Android 9 or above

```auto
@GET("joke.json")

```

It gives error:  
`java.lang.AssertionError: Error(s) present: [java.net.UnknownServiceException: CLEARTEXT communication to localhost not permitted by network security policy] (latch = 0, values = 0, errors = 1, completions = 0)`

When you run this test on Android 8 and below, it runs successfully.

Regards
