/**
 * Copyright Microsoft Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.microsoft.windowsazure.core.apache;

import com.microsoft.windowsazure.MockIntegrationTestBase;
import com.microsoft.windowsazure.core.ServiceClient;
import com.microsoft.windowsazure.core.pipeline.filter.ServiceRequestContext;
import com.microsoft.windowsazure.core.pipeline.filter.ServiceRequestFilter;
import com.microsoft.windowsazure.core.pipeline.filter.ServiceResponseContext;
import com.microsoft.windowsazure.core.pipeline.filter.ServiceResponseFilter;
import com.sun.deploy.net.HttpRequest;
import junit.framework.Assert;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestWrapper;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;
import static org.junit.Assert.*;

import java.io.IOException;
import java.net.URI;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;

public class HttpResponseInterceptorAdapterTest extends MockIntegrationTestBase {
    @Test
    public void responseFilterShouldWork() throws Exception {
        ServiceResponseFilter filterFirst = new ServiceResponseFilter() {
            @Override
            public void filter(ServiceRequestContext request, ServiceResponseContext response) {
                response.setHeader("header1", "value1");
            }
        };

        ServiceResponseFilter filterLast = new ServiceResponseFilter() {
            @Override
            public void filter(ServiceRequestContext request, ServiceResponseContext response) {
                response.setHeader("header1", "value2");
            }
        };

        class DummyClient extends ServiceClient<DummyClient> {
            public URI baseUri;

            public DummyClient()
            {
                super(HttpClientBuilder.create(), null);
            }

            @Override
            protected DummyClient newInstance(HttpClientBuilder httpClientBuilder, ExecutorService executorService) {
                return new DummyClient();
            }
        }

        DummyClient client = new DummyClient();
        client.baseUri = new URI("http://www.microsoft.com");

        addClient((ServiceClient<?>) client, new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                return null;
            }
        });
        setupTest();

        client.withResponseFilterFirst(filterFirst);
        client.withResponseFilterFirst(filterLast);

        HttpGet request = new HttpGet(client.baseUri);
        HttpResponse response = null;
        try {
            response = client.getHttpClient().execute(request);
        }
        finally {
            assertEquals(response.getFirstHeader("header1").getValue(), "value1");
            resetTest();
        }
    }
}

@@ -831,85 +831,8 @@
 xt;%0A
-import com.microsoft.windowsazure.core.pipeline.filter.ServiceRequestFilter;%0A
 impo
@@ -988,78 +988,8 @@
 er;%0A
-import com.sun.deploy.net.HttpRequest;%0Aimport junit.framework.Assert;%0A
 impo
@@ -1095,236 +1095,62 @@
 ttp.
-client.methods.HttpRequestWrapper;%0Aimport org.apache.http.client.methods.HttpUriRequest;%0Aimport org.apache.http.impl.client.HttpClientBuilder;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.*;%0A%0Aimport java.io.IOException;
+impl.client.HttpClientBuilder;%0Aimport org.junit.Test;%0A
 %0Aimp
@@ -1251,16 +1251,62 @@
 rvice;%0A%0A
+import static org.junit.Assert.assertEquals;%0A%0A
 public c

Remove unused dependency