@@ -765,6 +765,64 @@ void testThrownMcpErrorAndJsonRpcError() throws Exception {
765765 mcpServer .close ();
766766 }
767767
768+ @ Test
769+ void testInitializedNotificationCallReturnsAccepted () throws Exception {
770+ var mcpServer = McpServer .sync (mcpStatelessServerTransport )
771+ .serverInfo ("test-server" , "1.0.0" )
772+ .capabilities (ServerCapabilities .builder ().build ())
773+ .build ();
774+
775+ McpSchema .JSONRPCNotification notification = new McpSchema .JSONRPCNotification (McpSchema .JSONRPC_VERSION ,
776+ McpSchema .METHOD_NOTIFICATION_INITIALIZED , null );
777+
778+ MockHttpServletRequest request = new MockHttpServletRequest ("POST" , CUSTOM_MESSAGE_ENDPOINT );
779+ MockHttpServletResponse response = new MockHttpServletResponse ();
780+
781+ byte [] content = JSON_MAPPER .writeValueAsBytes (notification );
782+ request .setContent (content );
783+ request .addHeader ("Content-Type" , "application/json" );
784+ request .addHeader ("Content-Length" , Integer .toString (content .length ));
785+ request .addHeader ("Accept" , APPLICATION_JSON + ", " + TEXT_EVENT_STREAM );
786+ request .addHeader ("Cache-Control" , "no-cache" );
787+ request .addHeader (HttpHeaders .PROTOCOL_VERSION , ProtocolVersions .MCP_2025_03_26 );
788+
789+ mcpStatelessServerTransport .service (request , response );
790+
791+ assertThat (response .getStatus ()).isEqualTo (202 );
792+ assertThat (response .getContentAsByteArray ()).isEmpty ();
793+
794+ mcpServer .close ();
795+ }
796+
797+ @ Test
798+ void testRootsListChangedNotificationCallReturnsAccepted () throws Exception {
799+ var mcpServer = McpServer .sync (mcpStatelessServerTransport )
800+ .serverInfo ("test-server" , "1.0.0" )
801+ .capabilities (ServerCapabilities .builder ().build ())
802+ .build ();
803+
804+ McpSchema .JSONRPCNotification notification = new McpSchema .JSONRPCNotification (McpSchema .JSONRPC_VERSION ,
805+ McpSchema .METHOD_NOTIFICATION_ROOTS_LIST_CHANGED , null );
806+
807+ MockHttpServletRequest request = new MockHttpServletRequest ("POST" , CUSTOM_MESSAGE_ENDPOINT );
808+ MockHttpServletResponse response = new MockHttpServletResponse ();
809+
810+ byte [] content = JSON_MAPPER .writeValueAsBytes (notification );
811+ request .setContent (content );
812+ request .addHeader ("Content-Type" , "application/json" );
813+ request .addHeader ("Content-Length" , Integer .toString (content .length ));
814+ request .addHeader ("Accept" , APPLICATION_JSON + ", " + TEXT_EVENT_STREAM );
815+ request .addHeader ("Cache-Control" , "no-cache" );
816+ request .addHeader (HttpHeaders .PROTOCOL_VERSION , ProtocolVersions .MCP_2025_03_26 );
817+
818+ mcpStatelessServerTransport .service (request , response );
819+
820+ assertThat (response .getStatus ()).isEqualTo (202 );
821+ assertThat (response .getContentAsByteArray ()).isEmpty ();
822+
823+ mcpServer .close ();
824+ }
825+
768826 private double evaluateExpression (String expression ) {
769827 // Simple expression evaluator for testing
770828 return switch (expression ) {
0 commit comments