class ServerWrapper {

    public Boolean ping() {

        HttpUrl url = new HttpUrl.Builder()
                .scheme(this.Scheme)
                .host(this.Host)
                //.port(this.Port)
                .build();

        System.out.println("ServerWrapper: ping() " + url);

        Request request = new Request.Builder()
                .url(url)
                .get()
                .build();

        try {
            Response response = this.okHttpClient.newCall(request).execute();
            System.out.print(response.body());
            return response.isSuccessful();
        }
        catch (IOException e) {
            this.HasError = true;
            return false;
        }
        catch (IllegalStateException e) {
            this.HasError = true;
            return false;
        }
    }

}

class ServerWrapperTest {

    @Test
    public void ping_ResourceNotFound_ReturnsFalse() {


        MockInterceptor okHttpMockInterceptor = new MockInterceptor();
        okHttpMockInterceptor.addRule()
                .get()
                .url("https://jumpcutter.letum.ch/")
                .answer(request -> new Response.Builder().code(404));
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                .addInterceptor(okHttpMockInterceptor)
                .build();

        ServerWrapper server = new ServerWrapper(okHttpClient, null);
        Boolean response = server.ping();

        Assert.assertEquals(false, response);
    }

}