Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
43e9767
update some logging, add comments
robotdan May 13, 2025
55a2aba
working
robotdan May 13, 2025
5a2c059
working
robotdan May 13, 2025
981f84e
working
robotdan May 13, 2025
22dc35c
working
robotdan May 14, 2025
f128fbc
Add logging, and tests
robotdan May 15, 2025
dfdc104
Tests
robotdan May 15, 2025
8c8c3ec
Tests
robotdan May 15, 2025
6836604
Tests
robotdan May 15, 2025
c709bbb
Tests
robotdan May 15, 2025
309e8c3
Working
robotdan May 15, 2025
32746a9
Tests
robotdan May 16, 2025
8356101
Tests
robotdan May 16, 2025
af92fe8
Tests
robotdan May 16, 2025
8ae5cf1
copyright
robotdan May 16, 2025
2f7c476
Working
robotdan May 24, 2025
2376537
Working
robotdan May 24, 2025
b23099d
Working
robotdan May 28, 2025
d425944
Working
robotdan May 28, 2025
78e4c2e
Working
robotdan May 28, 2025
daaa59c
Working
robotdan May 28, 2025
2e0aa12
Working
robotdan May 28, 2025
409b40f
Working
robotdan May 28, 2025
55f14b3
Working
robotdan May 28, 2025
3d322ac
Working
robotdan May 28, 2025
9dc897f
Working
robotdan May 28, 2025
f7148a0
Working
robotdan May 30, 2025
a468f6b
Working
robotdan May 30, 2025
713ccb9
Working
robotdan May 30, 2025
91db717
Tests
robotdan May 30, 2025
e659c0e
Working
robotdan May 30, 2025
a0691f0
Working
robotdan May 30, 2025
797ed9c
Get Tomcat setup
robotdan May 30, 2025
598729b
README
robotdan May 30, 2025
31a8e6f
review edits
robotdan May 30, 2025
993eb99
build updates
robotdan May 30, 2025
cd8c7b7
Working
robotdan Jun 3, 2025
3c45a5c
Working
robotdan Jun 3, 2025
130b48c
Working
robotdan Jun 3, 2025
8a22c0c
Working
robotdan Jun 3, 2025
d69682c
Working
robotdan Jun 4, 2025
251c938
Working
robotdan Jun 4, 2025
d2950be
Working
robotdan Jun 4, 2025
5d312dd
Working
robotdan Jun 4, 2025
a56fce4
Working
robotdan Jun 4, 2025
2ec79ed
Working
robotdan Jun 4, 2025
4f0adc2
Working
robotdan Jun 5, 2025
6a73fa4
Add option to keep additional attributes on cookies
robotdan Jun 5, 2025
cff1c68
Working
robotdan Jun 6, 2025
8519136
Working
robotdan Jun 7, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tests
  • Loading branch information
robotdan committed May 15, 2025
commit 8c8c3ec4a6627e917c331b0509f4536548d725ad
24 changes: 18 additions & 6 deletions src/test/java/io/fusionauth/http/CoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,29 +589,41 @@ public void serverClosesSockets(String scheme) {
public void serverTimeout() throws Exception {
// This test simulates if the server has a long-running thread that doesn't write fast enough
HTTPHandler handler = (req, res) -> {
System.out.println("Handling");
System.out.println("Handling ... (slowly)");
// Note that if you comment out the sleep, the test should fail.
sleep(4_000L);
res.setStatus(200);
res.setContentLength(0L);
var body = "I'm slow but I'm good.".getBytes(StandardCharsets.UTF_8);
res.setContentLength(body.length);
res.getOutputStream().write(body);
res.getOutputStream().close();
System.out.println("Closed");
};

// TODO : Daniel Review : what are we trying to test here, this test isn't doing what we think.
// It seems we are writing to the server as a client, and the server is slow to write back.
// But this would be a client timeout and not a server timeout?
// Seems like we should use withProcessingTimeoutDuration instead of withInitialReadTimeout?
var instrumenter = new CountingInstrumenter();
try (var ignore = makeServer("http", handler, instrumenter).withInitialReadTimeout(Duration.ofSeconds(1)).start(); Socket socket = new Socket("127.0.0.1", 4242)) {
try (var ignore = makeServer("http", handler, instrumenter).withProcessingTimeoutDuration(Duration.ofSeconds(1)).start(); Socket socket = new Socket("127.0.0.1", 4242)) {
var out = socket.getOutputStream();
// 1. Write a body to the server
out.write("""
GET / HTTP/1.1\r
Host: localhost:42\r
Connection: close\r
Content-Length: 4\r
\r
body
""".getBytes());
out.flush();

var in = socket.getInputStream();
var body = in.readAllBytes();
assertEquals(body.length, 0, new String(body));
// 2. Read from the server, assuming you will receive a response.
// However, the server is very slow, it is going to wait 4s before it writes the response.
// - We have configured the server with a 1s read timeout.
// - Expect that we will have received a SocketTimeoutException and as such the response will be empty.
var response = socket.getInputStream().readAllBytes();
assertEquals(response.length, 0, new String(response));
assertEquals(instrumenter.getClosedConnections(), 1);
}
}
Expand Down