class HttpSender implements EventSender {

    @Override
    public void send(final File file, final CallbackHandler handler)
    {
        log.info("Sending local file to collector: {}", file.getAbsolutePath());
        final long startTime = System.nanoTime();

        final AsyncCompletionHandler<Response> asyncCompletionHandler = new AsyncCompletionHandler<Response>()
        {
            @Override
            public Response onCompleted(final Response response)
            {
                activeRequests.decrementAndGet();

                if (response.getStatusCode() == 202) {
                    handler.onSuccess(file);
                }
                else {
                    handler.onError(new IOException(String.format("Received response %d: %s",
                                                                  response.getStatusCode(), response.getStatusText())), file);
                }

                sendTimer.update(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
                return response; // never read
            }

            @Override
            public void onThrowable(final Throwable t)
            {
                activeRequests.decrementAndGet();
                handler.onError(t, file);
            }
        };

        final HttpJob job = new HttpJob(client, file, asyncCompletionHandler);
        workers.offer(job);
    }

    public  HttpSender(final String collectorHost, final int collectorPort, final EventType eventType,
                      final long httpMaxWaitTimeInMillis, final long httpMaxKeepAliveInMillis, final int httpWorkersPoolSize);
      HttpSender(final ThreadSafeAsyncHttpClient client, final long httpMaxWaitTimeInMillis, final Timer sendTimer, final int httpWorkersPoolSize);

}