Merged branch 'jetty-9.3.x' into 'master'.
This commit is contained in:
commit
82d0807863
|
@ -42,8 +42,8 @@ public class HttpConnectionOverHTTP extends AbstractConnection implements Connec
|
||||||
private static final Logger LOG = Log.getLogger(HttpConnectionOverHTTP.class);
|
private static final Logger LOG = Log.getLogger(HttpConnectionOverHTTP.class);
|
||||||
|
|
||||||
private final AtomicBoolean closed = new AtomicBoolean();
|
private final AtomicBoolean closed = new AtomicBoolean();
|
||||||
private final Promise<Connection> promise;
|
|
||||||
private final AtomicInteger sweeps = new AtomicInteger();
|
private final AtomicInteger sweeps = new AtomicInteger();
|
||||||
|
private final Promise<Connection> promise;
|
||||||
private final Delegate delegate;
|
private final Delegate delegate;
|
||||||
private final HttpChannelOverHTTP channel;
|
private final HttpChannelOverHTTP channel;
|
||||||
private long idleTimeout;
|
private long idleTimeout;
|
||||||
|
|
|
@ -59,6 +59,12 @@ public abstract class AbstractHttpClientServerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(Handler handler) throws Exception
|
public void start(Handler handler) throws Exception
|
||||||
|
{
|
||||||
|
startServer(handler);
|
||||||
|
startClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startServer(Handler handler) throws Exception
|
||||||
{
|
{
|
||||||
if (sslContextFactory != null)
|
if (sslContextFactory != null)
|
||||||
{
|
{
|
||||||
|
@ -79,8 +85,6 @@ public abstract class AbstractHttpClientServerTest
|
||||||
server.addConnector(connector);
|
server.addConnector(connector);
|
||||||
server.setHandler(handler);
|
server.setHandler(handler);
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
startClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startClient() throws Exception
|
protected void startClient() throws Exception
|
||||||
|
|
|
@ -1433,6 +1433,62 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
Assert.assertTrue(completeLatch.await(5, TimeUnit.SECONDS));
|
Assert.assertTrue(completeLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRequestSentOnlyAfterConnectionOpen() throws Exception
|
||||||
|
{
|
||||||
|
startServer(new AbstractHandler()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||||
|
{
|
||||||
|
baseRequest.setHandled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final AtomicBoolean open = new AtomicBoolean();
|
||||||
|
client = new HttpClient(new HttpClientTransportOverHTTP()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected HttpConnectionOverHTTP newHttpConnection(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise)
|
||||||
|
{
|
||||||
|
return new HttpConnectionOverHTTP(endPoint, destination, promise)
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onOpen()
|
||||||
|
{
|
||||||
|
open.set(true);
|
||||||
|
super.onOpen();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, sslContextFactory);
|
||||||
|
client.start();
|
||||||
|
|
||||||
|
final CountDownLatch latch = new CountDownLatch(2);
|
||||||
|
client.newRequest("localhost", connector.getLocalPort())
|
||||||
|
.scheme(scheme)
|
||||||
|
.onRequestBegin(new Request.BeginListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onBegin(Request request)
|
||||||
|
{
|
||||||
|
Assert.assertTrue(open.get());
|
||||||
|
latch.countDown();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.send(new Response.CompleteListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onComplete(Result result)
|
||||||
|
{
|
||||||
|
if (result.isSucceeded())
|
||||||
|
latch.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCONNECTWithHTTP10() throws Exception
|
public void testCONNECTWithHTTP10() throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue