Remove the request with a short sleep
The test still "does something" in that it has a method with a annotation.  Doesn't need to call an external url
package datadog.smoketest.cli;
import datadog.trace.api.Trace;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-/** Simple application that makes a request to example.com then quits. */
+/** Simple application that sleeps then quits. */
public class CliApplication {
public static void main(final String[] args) throws InterruptedException {
@@ -14,23 +11,15 @@ public class CliApplication {
// Sleep to ensure all of the processes are running
Thread.sleep(5000);
- System.out.println("Making request");
+ System.out.println("Calling example trace");
- app.makeRequest();
+ app.exampleTrace();
- System.out.println("Finished making request");
+ System.out.println("Finished calling example trace");
}
@Trace(operationName = "example")
- public void makeRequest() {
- try {
- final URL url = new URL("http://www.example.com/");
- final URLConnection connection = url.openConnection();
- connection.setConnectTimeout(1000);
- connection.connect();
- connection.getInputStream();
- } catch (final IOException e) {
- // Ignore. The goal of this app is to attempt the connection not necessarily to succeed
- }
+ public void exampleTrace() throws InterruptedException {
+ Thread.sleep(500);
}
}
