Merge branch 'master' of github.com:eclipse/jetty.project

This commit is contained in:
Joakim Erdfelt 2016-03-07 10:25:07 -07:00
commit fbb27addcd
3 changed files with 34 additions and 4 deletions

View File

@ -199,7 +199,9 @@ public class HttpClientTransportOverHTTP2 extends ContainerLifeCycle implements
@Override
public void onFailure(Session session, Throwable failure)
{
connection.close(failure);
HttpConnectionOverHTTP2 c = connection;
if (c != null)
c.close(failure);
}
}
}

View File

@ -6,9 +6,6 @@ org.eclipse.jetty.LEVEL=WARN
# org.eclipse.jetty.websocket.LEVEL=WARN
# org.eclipse.jetty.websocket.common.io.LEVEL=DEBUG
org.eclipse.jetty.websocket.common.WebSocketSession.LEVEL=DEBUG
org.eclipse.jetty.websocket.jsr356.LEVEL=DEBUG
### Show state changes on BrowserDebugTool
# -- LEAVE THIS AT DEBUG LEVEL --
org.eclipse.jetty.websocket.jsr356.server.browser.LEVEL=DEBUG

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http.client;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.EnumSet;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@ -39,7 +40,10 @@ import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http2.FlowControlStrategy;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
public class HttpClientTest extends AbstractTest
@ -285,6 +289,33 @@ public class HttpClientTest extends AbstractTest
Assert.assertEquals(response.getStatus(), 200);
}
@Test(expected = ExecutionException.class)
public void testClientCannotValidateServerCertificate() throws Exception
{
// Only run this test for transports over TLS.
Assume.assumeTrue(EnumSet.of(Transport.HTTPS, Transport.H2).contains(transport));
startServer(new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
baseRequest.setHandled(true);
}
});
// Use a default SslContextFactory, requests should fail because the server certificate is unknown.
client = newHttpClient(provideClientTransport(transport), new SslContextFactory());
QueuedThreadPool clientThreads = new QueuedThreadPool();
clientThreads.setName("client");
client.setExecutor(clientThreads);
client.start();
client.newRequest(newURI())
.timeout(5, TimeUnit.SECONDS)
.send();
}
private void sleep(long time) throws IOException
{
try