Move markInitialized/reconnect after status code check in Streamable HTTP transport by rameshreddy-adutla · Pull Request #851 · modelcontextprotocol/java-sdk
…HTTP transport When the server returns a non-2xx status code (e.g. 405 Method Not Allowed), markInitialized() and reconnect() were called before the status code was checked. This caused an unnecessary GET request, which is problematic when using transport fallback (Streamable HTTP -> SSE) as it creates duplicate SSE sessions on the server. Move markInitialized() and reconnect() inside the 2xx success branch so they are only called when the server actually accepted the connection. Fixes modelcontextprotocol#773 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>