fixed race in HttpReceiverOverHTTPTest
This commit is contained in:
parent
839485797b
commit
228600caf5
|
@ -301,6 +301,9 @@ public abstract class HttpReceiver
|
||||||
if (decoder != null)
|
if (decoder != null)
|
||||||
{
|
{
|
||||||
buffer = decoder.decode(buffer);
|
buffer = decoder.decode(buffer);
|
||||||
|
|
||||||
|
// TODO If the decoder consumes all the content, should we return here?
|
||||||
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Response content decoded ({}) {}{}{}", decoder, response, System.lineSeparator(), BufferUtil.toDetailString(buffer));
|
LOG.debug("Response content decoded ({}) {}{}{}", decoder, response, System.lineSeparator(), BufferUtil.toDetailString(buffer));
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.eclipse.jetty.http.HttpHeader;
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
||||||
import org.eclipse.jetty.toolchain.test.TestTracker;
|
import org.eclipse.jetty.toolchain.test.TestTracker;
|
||||||
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -230,8 +231,12 @@ public class HttpReceiverOverHTTPTest
|
||||||
@Override
|
@Override
|
||||||
public void onContent(Response response, ByteBuffer content)
|
public void onContent(Response response, ByteBuffer content)
|
||||||
{
|
{
|
||||||
|
boolean hadRemaining=content.hasRemaining();
|
||||||
super.onContent(response, content);
|
super.onContent(response, content);
|
||||||
latch.countDown();
|
|
||||||
|
// TODO gzip decoding can pass on empty chunks. Currently ignoring them here, but could be done at the decoder???
|
||||||
|
if (hadRemaining) // Ignore empty chunks
|
||||||
|
latch.countDown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
HttpExchange exchange = new HttpExchange(destination, request, Collections.<Response.ResponseListener>singletonList(listener));
|
HttpExchange exchange = new HttpExchange(destination, request, Collections.<Response.ResponseListener>singletonList(listener));
|
||||||
|
|
Loading…
Reference in New Issue