// Path: vertx-jersey/src/test/java/com/englishtown/vertx/jersey/integration/JerseyHK2IntegrationTestBase.java
// public abstract class JerseyHK2IntegrationTestBase extends JerseyIntegrationTestBase {
// 
//     public JerseyHK2IntegrationTestBase() {
//         super(new HK2TestServiceLocator());
//     }
// 
// }


import com.englishtown.vertx.jersey.integration.JerseyHK2IntegrationTestBase;
import com.englishtown.vertx.promises.RequestOptions;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.vertx.core.http.HttpMethod;
import org.junit.Test;
package com.englishtown.vertx.jersey.examples.integration;


public class ChunkedIntegrationTest extends JerseyHK2IntegrationTestBase {

    private String BASE_PATH = "http://localhost:8080/chunked";

    private void runTest(String path) {

        RequestOptions options = new RequestOptions()
                .setPauseResponse(true);

        getWhenHttpClient().requestAbs(HttpMethod.GET, path, options)
                .then(response -> {
                    assertEquals(200, response.statusCode());
                    assertEquals("chunked", response.headers().get(HttpHeaderNames.TRANSFER_ENCODING));
                    return getWhenHttpClient().body(response);
                })
                .then(body -> {
                    String text = body.toString();
                    assertTrue(text.startsWith("aaaaa"));
                    testComplete();
                    return null;
                })
                .otherwise(this::onRejected);

        await();

    }

    @Test
// Path: vertx-jersey/src/test/java/com/englishtown/vertx/jersey/integration/JerseyHK2IntegrationTestBase.java
// public abstract class JerseyHK2IntegrationTestBase extends JerseyIntegrationTestBase {
// 
//     public JerseyHK2IntegrationTestBase() {
//         super(new HK2TestServiceLocator());
//     }
// 
// }


// Path: examples/chunked/src/test/java/com/englishtown/vertx/jersey/examples/integration/ChunkedIntegrationTest.java
import com.englishtown.vertx.jersey.integration.JerseyHK2IntegrationTestBase;
import com.englishtown.vertx.promises.RequestOptions;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.vertx.core.http.HttpMethod;
import org.junit.Test;

package com.englishtown.vertx.jersey.examples.integration;


public class ChunkedIntegrationTest extends JerseyHK2IntegrationTestBase {

    private String BASE_PATH = "http://localhost:8080/chunked";

    private void runTest(String path) {

        RequestOptions options = new RequestOptions()
                .setPauseResponse(true);

        getWhenHttpClient().requestAbs(HttpMethod.GET, path, options)
                .then(response -> {
                    assertEquals(200, response.statusCode());
                    assertEquals("chunked", response.headers().get(HttpHeaderNames.TRANSFER_ENCODING));
                    return getWhenHttpClient().body(response);
                })
                .then(body -> {
                    String text = body.toString();
                    assertTrue(text.startsWith("aaaaa"));
                    testComplete();
                    return null;
                })
                .otherwise(this::onRejected);

        await();

    }

    @Test
    public void testGetChunkedString() throws Exception {