@@ -740,7 +740,7 @@ public void serverTimeout() throws Exception {
740
740
HTTPHandler handler = (req , res ) -> {
741
741
println ("Handling ... (slowly)" );
742
742
// Note that if you comment out the sleep, the test should fail.
743
- sleep (4_000L );
743
+ sleep (3_000L );
744
744
res .setStatus (200 );
745
745
var body = "I'm slow but I'm good." .getBytes (StandardCharsets .UTF_8 );
746
746
res .setContentLength (body .length );
@@ -749,12 +749,17 @@ public void serverTimeout() throws Exception {
749
749
println ("Closed" );
750
750
};
751
751
752
- // TODO : Daniel : Review : what are we trying to test here, this test isn't doing what we think.
753
- // It seems we are writing to the server as a client, and the server is slow to write back.
754
- // But this would be a client timeout and not a server timeout?
755
- // Seems like we should use withProcessingTimeoutDuration instead of withInitialReadTimeout?
756
752
var instrumenter = new CountingInstrumenter ();
757
- try (var ignore = makeServer ("http" , handler , instrumenter ).withProcessingTimeoutDuration (Duration .ofSeconds (1 )).start (); Socket socket = new Socket ("127.0.0.1" , 4242 )) {
753
+ try (var ignore = makeServer ("http" , handler , instrumenter )
754
+ // The processing timeout should be triggered due to how slow the server is to write back to the client.
755
+ // - Increase other timeouts to be certain we are testing the correct one.
756
+ .withProcessingTimeoutDuration (Duration .ofSeconds (1 ))
757
+ .withInitialReadTimeout (Duration .ofSeconds (30 ))
758
+ .withKeepAliveTimeoutDuration (Duration .ofSeconds (30 ))
759
+ .start ();
760
+
761
+ // Open a socket to the server and begin writing.
762
+ Socket socket = new Socket ("127.0.0.1" , 4242 )) {
758
763
var out = socket .getOutputStream ();
759
764
// 1. Write a body to the server
760
765
out .write ("""
0 commit comments