mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-01 19:39:21 +00:00
Revert "Fixed tests and suppressed expected exceptions."
This reverts commit 77b1617fdd925f67642e918bdd12bd4e61245942.
This commit is contained in:
parent
611e79945c
commit
0f3f051f0e
@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -37,7 +36,6 @@ import org.eclipse.jetty.client.http.HttpDestinationOverHTTP;
|
||||
import org.eclipse.jetty.client.util.ByteBufferContentProvider;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.log.StacklessLogging;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -258,8 +256,6 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
|
||||
@Test
|
||||
public void testAbortOnCommitWithContent() throws Exception
|
||||
{
|
||||
try (StacklessLogging suppressor = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class))
|
||||
{
|
||||
final AtomicReference<IOException> failure = new AtomicReference<>();
|
||||
start(new AbstractHandler()
|
||||
@ -270,7 +266,6 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
try
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
if (request.getDispatcherType() != DispatcherType.ERROR)
|
||||
IO.copy(request.getInputStream(), response.getOutputStream());
|
||||
}
|
||||
catch (IOException x)
|
||||
@ -318,30 +313,18 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbortOnContent() throws Exception
|
||||
{
|
||||
try (StacklessLogging suppressor = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class))
|
||||
{
|
||||
CountDownLatch serverLatch = new CountDownLatch(1);
|
||||
start(new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
try
|
||||
{
|
||||
super.handle(target, baseRequest, request, response);
|
||||
if (request.getDispatcherType() != DispatcherType.ERROR)
|
||||
IO.copy(request.getInputStream(), response.getOutputStream());
|
||||
}
|
||||
finally
|
||||
{
|
||||
serverLatch.countDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final Throwable cause = new Exception();
|
||||
@ -375,15 +358,12 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
Assert.assertSame(cause, x.getCause());
|
||||
}
|
||||
|
||||
Assert.assertTrue(serverLatch.await(5, TimeUnit.SECONDS));
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = InterruptedException.class)
|
||||
public void testInterrupt() throws Exception
|
||||
@ -397,7 +377,6 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
try
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
if (request.getDispatcherType() != DispatcherType.ERROR)
|
||||
TimeUnit.MILLISECONDS.sleep(2 * delay);
|
||||
}
|
||||
catch (InterruptedException x)
|
||||
@ -412,7 +391,10 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
.scheme(scheme);
|
||||
|
||||
final Thread thread = Thread.currentThread();
|
||||
new Thread(() ->
|
||||
new Thread()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -423,7 +405,8 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
throw new RuntimeException(x);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}.start();
|
||||
|
||||
request.send();
|
||||
}
|
||||
@ -440,7 +423,6 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
try
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
if (request.getDispatcherType() != DispatcherType.ERROR)
|
||||
TimeUnit.MILLISECONDS.sleep(2 * delay);
|
||||
}
|
||||
catch (InterruptedException x)
|
||||
@ -457,7 +439,10 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
final Throwable cause = new Exception();
|
||||
final AtomicBoolean aborted = new AtomicBoolean();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
new Thread(() ->
|
||||
new Thread()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -469,7 +454,8 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
throw new RuntimeException(x);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}.start();
|
||||
|
||||
try
|
||||
{
|
||||
@ -501,7 +487,6 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||
try
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
if (request.getDispatcherType() != DispatcherType.ERROR)
|
||||
TimeUnit.MILLISECONDS.sleep(2 * delay);
|
||||
}
|
||||
catch (InterruptedException x)
|
||||
|
Loading…
x
Reference in New Issue
Block a user