package de.duehl.html.download.start;

import static org.junit.Assert.*;

import java.io.IOException;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;

public class HttpClientTest {

    /*
     * Klappt nicht wegen Timeout, no proxy here!
     */

    @Test
    public void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected()
      throws ClientProtocolException, IOException {
        HttpClient instance = HttpClientBuilder.create().disableRedirectHandling().build();
        HttpResponse response = instance.execute(new HttpGet("http://t.co/I5YYd9tddw"));

        assertEquals(301, response.getStatusLine().getStatusCode());
    }

}
