Skip to content

Commit

Permalink
fail HTTP randomly for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Apr 8, 2024
1 parent 074b2fa commit 289e16c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Random;

public abstract class SimpleHttpHandler implements HttpHandler {
private final boolean logRequests = false;

private final Random random = new Random();

@Override
public final void handle(HttpExchange exchange) throws IOException {
if (random.nextBoolean()) {
System.out.println("I'm not doing stuff this time...");
exchange.close();
return;
}

try {
if (logRequests) {
System.out.println(
Expand Down

0 comments on commit 289e16c

Please sign in to comment.