From: <asa...@us...> - 2014-03-22 05:00:20
|
Revision: 9201 http://sourceforge.net/p/htmlunit/code/9201 Author: asashour Date: 2014-03-22 05:00:14 +0000 (Sat, 22 Mar 2014) Log Message: ----------- HttpWebConnection: socket reuse (regression in 2.14). Issue 1577 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-03-22 04:54:54 UTC (rev 9200) +++ trunk/htmlunit/src/changes/changes.xml 2014-03-22 05:00:14 UTC (rev 9201) @@ -8,6 +8,9 @@ <body> <release version="2.15" date="???" description="Bugfixes"> + <action type="fix" dev="asashour" issue="1577"> + HttpWebConnection: socket reuse (regression in 2.14). + </action> <action type="fix" dev="mguillem" issue="1559"> JavaScript: allow use of "in" operator with indexes for StaticNodeList and Attr. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-03-22 04:54:54 UTC (rev 9200) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2014-03-22 05:00:14 UTC (rev 9201) @@ -910,6 +910,7 @@ */ final class HtmlUnitHttpClientBuilder { + private static PoolingHttpClientConnectionManager poolingmgr; private HtmlUnitHttpClientBuilder() { } @@ -918,6 +919,10 @@ * <code>socketFactory</code>. */ public static void configureConnectionManager(final HttpClientBuilder builder) { + if (poolingmgr != null) { + builder.setConnectionManager(poolingmgr); + return; + } final ConnectionSocketFactory socketFactory = new SocksConnectionSocketFactory(); LayeredConnectionSocketFactory sslSocketFactory = @@ -957,7 +962,7 @@ } } - final PoolingHttpClientConnectionManager poolingmgr = new PoolingHttpClientConnectionManager( + poolingmgr = new PoolingHttpClientConnectionManager( RegistryBuilder.<ConnectionSocketFactory>create() .register("http", socketFactory) .register("https", sslSocketFactory) Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-03-22 04:54:54 UTC (rev 9200) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnectionTest.java 2014-03-22 05:00:14 UTC (rev 9201) @@ -53,7 +53,6 @@ import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; -import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider2Test.InMemoryAppender; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.util.KeyDataPair; @@ -444,7 +443,6 @@ * @throws Exception if the test fails */ @Test - @NotYetImplemented public void remotePort() throws Exception { final Map<String, Class<? extends Servlet>> servlets = new HashMap<String, Class<? extends Servlet>>(); servlets.put("/test", RemotePortServlet.class); |