more robust test by avoiding SSL close race

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-03-06 14:29:53 +11:00
parent 4b62ab6006
commit e99f28bc17
1 changed files with 5 additions and 2 deletions

View File

@ -298,7 +298,8 @@ public class ThreadStarvationTest
List<Callable<Long>> clientTasks = new ArrayList<>(); List<Callable<Long>> clientTasks = new ArrayList<>();
for(int i=0; i<CLIENTS; i++) { for(int i=0; i<CLIENTS; i++)
{
clientTasks.add(() -> clientTasks.add(() ->
{ {
try (Socket client = clientSocketProvider.newSocket("localhost", _connector.getLocalPort()); try (Socket client = clientSocketProvider.newSocket("localhost", _connector.getLocalPort());
@ -346,7 +347,8 @@ public class ThreadStarvationTest
Long bodyCount = responseFut.get(); Long bodyCount = responseFut.get();
assertThat(bodyCount.longValue(), is(expected)); assertThat(bodyCount.longValue(), is(expected));
} }
} finally }
finally
{ {
clientExecutors.shutdownNow(); clientExecutors.shutdownNow();
} }
@ -366,6 +368,7 @@ public class ThreadStarvationTest
baseRequest.setHandled(true); baseRequest.setHandled(true);
response.setStatus(200); response.setStatus(200);
response.setContentLength(BUFFERS*BUFFER_SIZE);
OutputStream out = response.getOutputStream(); OutputStream out = response.getOutputStream();
for (int i=0;i<BUFFERS;i++) for (int i=0;i<BUFFERS;i++)
{ {