Skip to content

Commit

Permalink
Small tidy up of ApacheHttpClient again
Browse files Browse the repository at this point in the history
I accidentally left in a `main` method, and there was
some wonky formatting and unused imports.
  • Loading branch information
shs96c committed Apr 12, 2017
1 parent 70dcab8 commit 509d88a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.apache.http.protocol.HttpCoreContext.HTTP_TARGET_HOST;

import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.NoHttpResponseException;
Expand All @@ -43,7 +42,6 @@

import java.io.IOException;
import java.net.BindException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
Expand Down Expand Up @@ -251,24 +249,9 @@ private static synchronized HttpClientFactory getDefaultHttpClientFactory() {
return defaultClientFactory;
}
}

@Override
public void close() throws IOException {
client.getConnectionManager().closeIdleConnections(0, TimeUnit.SECONDS);
}

public static void main(String[] args) throws IOException {
org.openqa.selenium.remote.http.HttpClient client = new Factory().createClient(new URL("http://www.google.com/"));

HttpRequest request = new HttpRequest(HttpMethod.GET, "/");
HttpResponse response = client.execute(request, true);

for (String names : response.getHeaderNames()) {
Iterable<String> header = response.getHeaders(names);
for (String h : header) {
System.out.println(names + ": " + h);
}
}
@Override
public void close() throws IOException {
client.getConnectionManager().closeIdleConnections(0, TimeUnit.SECONDS);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@

package org.openqa.selenium.remote.internal;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;

import org.junit.Test;
import org.openqa.selenium.net.PortProber;
import org.openqa.selenium.remote.http.HttpClient;
import org.openqa.selenium.remote.http.HttpMethod;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
import org.seleniumhq.jetty9.server.HttpConnectionFactory;
import org.seleniumhq.jetty9.server.Server;
import org.seleniumhq.jetty9.server.ServerConnector;
import org.seleniumhq.jetty9.servlet.ServletContextHandler;
import org.seleniumhq.jetty9.servlet.ServletHolder;

Expand Down

0 comments on commit 509d88a

Please sign in to comment.