diff --git a/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java b/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java index 1126cb38c..76cbc2227 100644 --- a/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java +++ b/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java @@ -181,7 +181,7 @@ public void undeploy(Archive archive) throws DeploymentException { LOGGER.log(INFO, "Waiting for Piranha to be shutdown"); long startTime = System.currentTimeMillis(); - process.waitFor(5, TimeUnit.MINUTES); + process.waitFor(30, TimeUnit.SECONDS); Long finishTime = System.currentTimeMillis(); LOGGER.log(INFO, "Piranha has shutdown\n It took {0} milliseconds", finishTime - startTime); diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebApplicationInputStream.java b/core/api/src/main/java/cloud/piranha/core/api/WebApplicationInputStream.java index 64b7c1e1a..720eaae48 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebApplicationInputStream.java +++ b/core/api/src/main/java/cloud/piranha/core/api/WebApplicationInputStream.java @@ -120,10 +120,12 @@ public int read() throws IOException { if (finished || webApplicationRequest.getContentLength() == 0) { return -1; } - read = inputStream.read(); - index++; - if (index == webApplicationRequest.getContentLength() || read == -1) { - finished = true; + if (inputStream.available() > 0) { + read = inputStream.read(); + index++; + if (index == webApplicationRequest.getContentLength() || read == -1) { + finished = true; + } } } else { if (inputStream.available() > 0) { diff --git a/external/coreprofile-tck/rest/README.md b/external/coreprofile-tck/rest/README.md index 17abe4bb4..abd3c5e59 100644 --- a/external/coreprofile-tck/rest/README.md +++ b/external/coreprofile-tck/rest/README.md @@ -13,21 +13,21 @@ mvn -Dit.test=TestName verify To run a single test in debug mode, use the following command: ``` -mvn -Dmaven.surefire.debug -Dit.test=TestName verify +mvn -Dmaven.failsafe.debug -Dit.test=TestName verify ``` To run a single test in debug mode with a specific port, use the following command: ``` -mvn -Dmaven.surefire.debug -Dmaven.surefire.debug.port=5005 -Dit.test=TestName verify +mvn -Dmaven.failsafe.debug -Dmaven.failsafe.debug.port=5005 -Dit.test=TestName verify ``` To run a single test in debug mode with a specific port and suspend, use the following command: ``` -mvn -Dmaven.surefire.debug -Dmaven.surefire.debug.port=5005 -Dmaven.surefire.debug.suspend=y -Dit.test=TestName verify +mvn -Dmaven.failsafe.debug -Dmaven.failsafe.debug.port=5005 -Dmaven.failsafe.debug.suspend=y -Dit.test=TestName verify ``` To run a single test and put Piranha in debug and susspend mode use the diff --git a/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServer.java b/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServer.java index a7b7b5f8a..0220ecd05 100644 --- a/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServer.java +++ b/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServer.java @@ -99,7 +99,7 @@ public class DefaultHttpServer implements HttpServer { /** * Stores the SO_TIMEOUT. */ - protected int soTimeout; + protected int soTimeout = 60000; /** * Stores the SSL flag. diff --git a/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServerAcceptorThread.java b/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServerAcceptorThread.java index 259d88637..6815f5b26 100644 --- a/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServerAcceptorThread.java +++ b/http/impl/src/main/java/cloud/piranha/http/impl/DefaultHttpServerAcceptorThread.java @@ -73,6 +73,7 @@ public void run() { while (!server.serverStopRequest) { try { Socket socket = server.serverSocket.accept(); + socket.setSoTimeout(60000); server.executorService.execute(new DefaultHttpServerProcessingThread(server, socket)); } catch (IOException exception) { // not interesting to do anything with this here as the client probably just hung up.