class HttpProtocolClient implements ProtocolClient {

    @Override
    public Observable<Content> observeResource(Form form) {
        // long timeout for long polling
        RequestConfig config = RequestConfig.custom()
                .setConnectTimeout((int) LONG_POLLING_TIMEOUT.toMillis())
                .setConnectionRequestTimeout((int) LONG_POLLING_TIMEOUT.toMillis())
                .setSocketTimeout((int) LONG_POLLING_TIMEOUT.toMillis()).build();

        HttpUriRequest request = generateRequest(form);

        return Observable.using(
                () -> clientCreator.apply(config),
                client -> Observable.<Content>create(source -> {
                    while (!source.isDisposed()) {
                        log.debug("Sending '{}' to '{}'", request.getMethod(), request.getURI());
                        try {
                            HttpResponse response = client.execute(request);
                            Content content = checkResponse(response);
                            log.debug("Next data received for Event connection");
                            source.onNext(content);
                        }
                        catch (IOException | ProtocolClientException e) {
                            log.warn("Error received for Event connection", e);
                            source.onError(e);
                        }
                    }
                }),
                Closeable::close
        ).subscribeOn(Schedulers.io());
    }

    public  HttpProtocolClient();
      HttpProtocolClient(HttpClient requestClient,
                       Function<RequestConfig, CloseableHttpClient> clientCreator);

}