@@ -639,6 +639,64 @@ void testThrownMcpErrorAndJsonRpcError() throws Exception {
639639 mcpServer .close ();
640640 }
641641
642+ @ Test
643+ void testInitializedNotificationCallReturnsAccepted () throws Exception {
644+ var mcpServer = McpServer .sync (mcpStatelessServerTransport )
645+ .serverInfo ("test-server" , "1.0.0" )
646+ .capabilities (ServerCapabilities .builder ().build ())
647+ .build ();
648+
649+ McpSchema .JSONRPCNotification notification = new McpSchema .JSONRPCNotification (McpSchema .JSONRPC_VERSION ,
650+ McpSchema .METHOD_NOTIFICATION_INITIALIZED , null );
651+
652+ MockHttpServletRequest request = new MockHttpServletRequest ("POST" , CUSTOM_MESSAGE_ENDPOINT );
653+ MockHttpServletResponse response = new MockHttpServletResponse ();
654+
655+ byte [] content = JSON_MAPPER .writeValueAsBytes (notification );
656+ request .setContent (content );
657+ request .addHeader ("Content-Type" , "application/json" );
658+ request .addHeader ("Content-Length" , Integer .toString (content .length ));
659+ request .addHeader ("Accept" , APPLICATION_JSON + ", " + TEXT_EVENT_STREAM );
660+ request .addHeader ("Cache-Control" , "no-cache" );
661+ request .addHeader (HttpHeaders .PROTOCOL_VERSION , ProtocolVersions .MCP_2025_03_26 );
662+
663+ mcpStatelessServerTransport .service (request , response );
664+
665+ assertThat (response .getStatus ()).isEqualTo (202 );
666+ assertThat (response .getContentAsByteArray ()).isEmpty ();
667+
668+ mcpServer .close ();
669+ }
670+
671+ @ Test
672+ void testRootsListChangedNotificationCallReturnsAccepted () throws Exception {
673+ var mcpServer = McpServer .sync (mcpStatelessServerTransport )
674+ .serverInfo ("test-server" , "1.0.0" )
675+ .capabilities (ServerCapabilities .builder ().build ())
676+ .build ();
677+
678+ McpSchema .JSONRPCNotification notification = new McpSchema .JSONRPCNotification (McpSchema .JSONRPC_VERSION ,
679+ McpSchema .METHOD_NOTIFICATION_ROOTS_LIST_CHANGED , null );
680+
681+ MockHttpServletRequest request = new MockHttpServletRequest ("POST" , CUSTOM_MESSAGE_ENDPOINT );
682+ MockHttpServletResponse response = new MockHttpServletResponse ();
683+
684+ byte [] content = JSON_MAPPER .writeValueAsBytes (notification );
685+ request .setContent (content );
686+ request .addHeader ("Content-Type" , "application/json" );
687+ request .addHeader ("Content-Length" , Integer .toString (content .length ));
688+ request .addHeader ("Accept" , APPLICATION_JSON + ", " + TEXT_EVENT_STREAM );
689+ request .addHeader ("Cache-Control" , "no-cache" );
690+ request .addHeader (HttpHeaders .PROTOCOL_VERSION , ProtocolVersions .MCP_2025_03_26 );
691+
692+ mcpStatelessServerTransport .service (request , response );
693+
694+ assertThat (response .getStatus ()).isEqualTo (202 );
695+ assertThat (response .getContentAsByteArray ()).isEmpty ();
696+
697+ mcpServer .close ();
698+ }
699+
642700 private double evaluateExpression (String expression ) {
643701 // Simple expression evaluator for testing
644702 return switch (expression ) {
0 commit comments