package net.lightbody.bmp.proxy;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class SslTest extends ProxyServerTest {
    @Test
    public void testFidelity() throws Exception {
        get("https://www.fidelity.com/");
    }

    @Test
    public void testNewRelic() throws Exception {
        // see https://github.com/webmetrics/browsermob-proxy/issues/105
        proxy.remapHost("foo.newrelic.com", "rpm.newrelic.com");
        proxy.remapHost("bar.newrelic.com", "rpm.newrelic.com");
        get("https://foo.newrelic.com/");
        get("https://bar.newrelic.com/");
        get("https://rpm.newrelic.com/");
    }

    private void get(String url) throws IOException {
        HttpGet get = new HttpGet(url);
        HttpResponse response = client.execute(get);
        Assert.assertEquals("Expected 200 when fetching " + url, 200, response.getStatusLine().getStatusCode());
    }
}

@@ -341,24 +341,139 @@
 /%22);%0A    %7D%0A%0A
+    @Test%0A    public void testSalesforce() throws Exception %7B%0A        get(%22https://login.salesforce.com/%22);%0A    %7D%0A%0A
     @Test%0A  

test to confirm salesforce works (it was reported as not working on the mailing list)