in app-gradle-plugin/src/integTest/java/com/google/cloud/tools/gradle/appengine/AppEngineStandardPluginIntegrationTest.java [71:115]
public void testDevAppServer_sync() throws IOException, InterruptedException {
Thread.UncaughtExceptionHandler handler = (thread, throwable) -> threadException = throwable;
Thread thread =
new Thread(
() -> {
try {
// Attempt to connect to server for 60 seconds
AssertConnection.assertResponseWithRetries(
"http://localhost:8080",
200,
"Hello from the App Engine Standard project.",
60000);
} catch (InterruptedException ex) {
Assert.fail(ex.getMessage());
} finally {
// stop server
try {
GradleRunner.create()
.withProjectDir(testProjectDir.getRoot())
.withPluginClasspath()
.withArguments("appengineStop")
.build();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
thread.setUncaughtExceptionHandler(handler);
thread.setDaemon(true);
thread.start();
GradleRunner.create()
.withProjectDir(testProjectDir.getRoot())
.withPluginClasspath()
.withArguments("appengineRun")
.build();
thread.join();
if (threadException != null) {
Assert.fail(threadException.getMessage());
}
AssertConnection.assertUnreachable("http://localhost:8080", 8000);
}