@@ -49,7 +49,7 @@ class StreamableHttpAcpAgentTransportIntegrationTest {
4949
5050 @ Test
5151 void javaClientCanTalkToRunningJavaServer () throws Exception {
52- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
52+ try (FixtureServer server = FixtureServer .start ()) {
5353 AcpAsyncClient client = AcpClient
5454 .async (new StreamableHttpAcpClientTransport (server .endpoint (), AcpJsonMapper .createDefault ()))
5555 .requestTimeout (TIMEOUT )
@@ -73,7 +73,7 @@ void javaClientCanTalkToRunningJavaServer() throws Exception {
7373
7474 @ Test
7575 void permissionRequestRoundTripsOverSessionStream () throws Exception {
76- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
76+ try (FixtureServer server = FixtureServer .start ()) {
7777 AtomicInteger permissionRequests = new AtomicInteger ();
7878 AcpAsyncClient client = AcpClient
7979 .async (new StreamableHttpAcpClientTransport (server .endpoint (), AcpJsonMapper .createDefault ()))
@@ -103,7 +103,7 @@ void permissionRequestRoundTripsOverSessionStream() throws Exception {
103103
104104 @ Test
105105 void compatibleModeAllowsSessionLoadPreopen () throws Exception {
106- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
106+ try (FixtureServer server = FixtureServer .start ()) {
107107 AcpAsyncClient client = AcpClient
108108 .async (new StreamableHttpAcpClientTransport (server .endpoint (), AcpJsonMapper .createDefault ()))
109109 .requestTimeout (TIMEOUT )
@@ -122,7 +122,7 @@ void compatibleModeAllowsSessionLoadPreopen() throws Exception {
122122
123123 @ Test
124124 void supportsTwoLogicalSessions () throws Exception {
125- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
125+ try (FixtureServer server = FixtureServer .start ()) {
126126 AcpAsyncClient client = AcpClient
127127 .async (new StreamableHttpAcpClientTransport (server .endpoint (), AcpJsonMapper .createDefault ()))
128128 .requestTimeout (TIMEOUT )
@@ -153,7 +153,7 @@ void supportsTwoLogicalSessions() throws Exception {
153153
154154 @ Test
155155 void wrongStreamClientResponseIsRejected () throws Exception {
156- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
156+ try (FixtureServer server = FixtureServer .start ()) {
157157 HttpClient rawClient = HttpClient .newHttpClient ();
158158 String connectionId = initializeRaw (rawClient , server .endpoint ());
159159 try (SseReader connectionStream = SseReader .open (rawClient , server .endpoint (), connectionId , null )) {
@@ -187,7 +187,7 @@ void wrongStreamClientResponseIsRejected() throws Exception {
187187
188188 @ Test
189189 void validationFailuresUseHttpStatusCodes () throws Exception {
190- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
190+ try (FixtureServer server = FixtureServer .start ()) {
191191 HttpClient rawClient = HttpClient .newHttpClient ();
192192 HttpResponse <String > jsonWithCharset = rawClient .send (HttpRequest .newBuilder (server .endpoint ())
193193 .header ("Content-Type" , "application/json; charset=utf-8" )
@@ -228,7 +228,7 @@ void validationFailuresUseHttpStatusCodes() throws Exception {
228228
229229 @ Test
230230 void connectionReplayDeliversSessionNewWhenSseAttachesAfterPost () throws Exception {
231- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
231+ try (FixtureServer server = FixtureServer .start ()) {
232232 HttpClient rawClient = HttpClient .newHttpClient ();
233233 String connectionId = initializeRaw (rawClient , server .endpoint ());
234234
@@ -251,7 +251,7 @@ void connectionReplayDeliversSessionNewWhenSseAttachesAfterPost() throws Excepti
251251
252252 @ Test
253253 void sessionReplayDeliversPromptEventsWhenSseAttachesAfterPost () throws Exception {
254- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
254+ try (FixtureServer server = FixtureServer .start ()) {
255255 HttpClient rawClient = HttpClient .newHttpClient ();
256256 String connectionId = initializeRaw (rawClient , server .endpoint ());
257257 String sessionId = createSession (rawClient , server .endpoint (), connectionId );
@@ -275,7 +275,7 @@ void sessionReplayDeliversPromptEventsWhenSseAttachesAfterPost() throws Exceptio
275275
276276 @ Test
277277 void concurrentPostsToSameConnectionAreBothAcceptedAndRouted () throws Exception {
278- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
278+ try (FixtureServer server = FixtureServer .start ()) {
279279 HttpClient rawClient = HttpClient .newHttpClient ();
280280 String connectionId = initializeRaw (rawClient , server .endpoint ());
281281 ExecutorService executor = Executors .newFixedThreadPool (2 );
@@ -313,7 +313,7 @@ void concurrentPostsToSameConnectionAreBothAcceptedAndRouted() throws Exception
313313
314314 @ Test
315315 void sessionScopedMessagesValidateSessionHeader () throws Exception {
316- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
316+ try (FixtureServer server = FixtureServer .start ()) {
317317 HttpClient rawClient = HttpClient .newHttpClient ();
318318 String connectionId = initializeRaw (rawClient , server .endpoint ());
319319 String sessionId = createSession (rawClient , server .endpoint (), connectionId );
@@ -350,7 +350,7 @@ void sessionScopedMessagesValidateSessionHeader() throws Exception {
350350
351351 @ Test
352352 void deleteClosesSseAndRemovesConnection () throws Exception {
353- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
353+ try (FixtureServer server = FixtureServer .start ()) {
354354 HttpClient rawClient = HttpClient .newHttpClient ();
355355 String connectionId = initializeRaw (rawClient , server .endpoint ());
356356 try (SseReader connectionStream = SseReader .open (rawClient , server .endpoint (), connectionId , null )) {
@@ -385,7 +385,7 @@ void deleteClosesSseAndRemovesConnection() throws Exception {
385385
386386 @ Test
387387 void replayOverflowClosesConnectionInsteadOfDroppingMessages () throws Exception {
388- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport . RoutingMode . COMPATIBLE )) {
388+ try (FixtureServer server = FixtureServer .start ()) {
389389 HttpClient rawClient = HttpClient .newHttpClient ();
390390 String connectionId = initializeRaw (rawClient , server .endpoint ());
391391
@@ -404,31 +404,6 @@ void replayOverflowClosesConnectionInsteadOfDroppingMessages() throws Exception
404404 }
405405 }
406406
407- @ Test
408- void strictModeRejectsUnknownSessionStream () throws Exception {
409- try (FixtureServer server = FixtureServer .start (StreamableHttpAcpAgentTransport .RoutingMode .STRICT )) {
410- HttpResponse <Void > response = HttpClient .newHttpClient ()
411- .send (HttpRequest .newBuilder (server .endpoint ())
412- .header ("Content-Type" , "application/json" )
413- .header ("Accept" , "application/json" )
414- .POST (HttpRequest .BodyPublishers .ofString ("""
415- {"jsonrpc":"2.0","id":"init-1","method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{}}}
416- """ ))
417- .build (), HttpResponse .BodyHandlers .discarding ());
418- String connectionId = response .headers ().firstValue ("Acp-Connection-Id" ).orElseThrow ();
419- HttpResponse <Void > unknownSession = HttpClient .newHttpClient ()
420- .send (HttpRequest .newBuilder (server .endpoint ())
421- .header ("Accept" , "text/event-stream" )
422- .header ("Acp-Connection-Id" , connectionId )
423- .header ("Acp-Session-Id" , "unknown" )
424- .GET ()
425- .build (), HttpResponse .BodyHandlers .discarding ());
426-
427- assertThat (response .statusCode ()).isEqualTo (200 );
428- assertThat (unknownSession .statusCode ()).isEqualTo (404 );
429- }
430- }
431-
432407 private static String initializeRaw (HttpClient client , URI endpoint ) throws Exception {
433408 HttpResponse <String > initialize = client .send (HttpRequest .newBuilder (endpoint )
434409 .header ("Content-Type" , "application/json" )
@@ -494,7 +469,7 @@ private FixtureServer(StreamableHttpAcpAgentTransport transport) {
494469 this .transport = transport ;
495470 }
496471
497- static FixtureServer start (StreamableHttpAcpAgentTransport . RoutingMode routingMode ) throws Exception {
472+ static FixtureServer start () throws Exception {
498473 AtomicInteger sessionCounter = new AtomicInteger ();
499474 AcpAgentFactory agentFactory = AcpAgentFactory .async (transport -> AcpAgent .async (transport )
500475 .initializeHandler (request -> Mono .just (new AcpSchema .InitializeResponse (
@@ -511,7 +486,7 @@ static FixtureServer start(StreamableHttpAcpAgentTransport.RoutingMode routingMo
511486 })
512487 .build ());
513488 StreamableHttpAcpAgentTransport transport = new StreamableHttpAcpAgentTransport (
514- freePort (), AcpJsonMapper .createDefault (), agentFactory ). routingMode ( routingMode ) ;
489+ freePort (), AcpJsonMapper .createDefault (), agentFactory );
515490 transport .start ().block (TIMEOUT );
516491 return new FixtureServer (transport );
517492 }
0 commit comments