changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
458d67e3db
commit
60c56d8856
|
@ -46,16 +46,10 @@ class XmlBasedHttpClientProvider
|
|||
Thread.currentThread().setContextClassLoader(HttpClient.class.getClassLoader());
|
||||
return newHttpClient(resource);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
LOG.warn("Failure to load HttpClient from XML", t);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(contextClassLoader);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static HttpClient newHttpClient(URL resource)
|
||||
|
@ -67,7 +61,7 @@ class XmlBasedHttpClientProvider
|
|||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
LOG.warn("Unable to load: {}", resource, t);
|
||||
LOG.warn("Failure to load HttpClient from XML {}", resource, t);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -351,9 +351,7 @@ public class DistributionTests extends AbstractDistributionTest
|
|||
assertEquals(HttpStatus.OK_200, response.getStatus());
|
||||
String content = response.getContentAsString();
|
||||
assertThat(content, containsString("WebSocketEcho: success"));
|
||||
|
||||
// We cannot test the HttpClient timeout because it is a server class not exposed to the webapp.
|
||||
// assertThat(content, containsString("ConnectTimeout: 4999"));
|
||||
assertThat(content, containsString("ConnectTimeout: 4999"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -387,6 +385,7 @@ public class DistributionTests extends AbstractDistributionTest
|
|||
String[] args2 = {
|
||||
"jetty.http.port=" + port,
|
||||
"jetty.ssl.port=" + port,
|
||||
// We must hide the websocket classes from the webapp if we are to include websocket client jars in WEB-INF/lib.
|
||||
"jetty.webapp.addServerClasses+=,+org.eclipse.jetty.websocket.",
|
||||
"jetty.webapp.addSystemClasses+=,-org.eclipse.jetty.websocket.",
|
||||
// "jetty.server.dumpAfterStart=true",
|
||||
|
|
Binary file not shown.
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.tests.webapp.websocket;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
@ -45,7 +46,7 @@ public class WebSocketClientServlet extends HttpServlet
|
|||
@Override
|
||||
public void init() throws ServletException
|
||||
{
|
||||
// We must rely on jetty-websocket-httpclient.xml as we do not have access to server classes like HttpClient.
|
||||
// Cannot instantiate an HttpClient here because it's a server class, and therefore must rely on jetty-websocket-httpclient.xml
|
||||
client = new WebSocketClient();
|
||||
|
||||
try
|
||||
|
@ -90,8 +91,11 @@ public class WebSocketClientServlet extends HttpServlet
|
|||
PrintWriter writer = resp.getWriter();
|
||||
writer.println("WebSocketEcho: " + ("test message".equals(response) ? "success" : "failure"));
|
||||
writer.println("WebSocketEcho: success");
|
||||
// We cannot test the HttpClient timeout because it is a server class not exposed to the webapp.
|
||||
// writer.println("ConnectTimeout: " + client.getHttpClient().getConnectTimeout());
|
||||
|
||||
// We need to test HttpClient timeout with reflection because it is a server class not exposed to the webapp.
|
||||
Object httpClient = client.getHttpClient();
|
||||
Method getConnectTimeout = httpClient.getClass().getMethod("getConnectTimeout");
|
||||
writer.println("ConnectTimeout: " + getConnectTimeout.invoke(httpClient));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue