66import java .util .UUID ;
77
88import io .a2a .client .http .A2ACardResolver ;
9- import io .a2a .client .http .A2AHttpClient ;
10- import io .a2a .client .http .JdkA2AHttpClient ;
9+ import io .a2a .client .http .HttpClient ;
1110import io .a2a .spec .A2AClientError ;
1211import io .a2a .spec .A2AClientJSONError ;
1312import io .a2a .spec .AgentCard ;
@@ -139,7 +138,7 @@ private static Message toMessage(List<Part<?>> parts, Message.Role role, String
139138 * @throws A2AClientJSONError f the response body cannot be decoded as JSON or validated against the AgentCard schema
140139 */
141140 public static AgentCard getAgentCard (String agentUrl ) throws A2AClientError , A2AClientJSONError {
142- return getAgentCard (new JdkA2AHttpClient ( ), agentUrl );
141+ return getAgentCard (HttpClient . createHttpClient ( agentUrl ), agentUrl );
143142 }
144143
145144 /**
@@ -151,7 +150,7 @@ public static AgentCard getAgentCard(String agentUrl) throws A2AClientError, A2A
151150 * @throws A2AClientError If an HTTP error occurs fetching the card
152151 * @throws A2AClientJSONError f the response body cannot be decoded as JSON or validated against the AgentCard schema
153152 */
154- public static AgentCard getAgentCard (A2AHttpClient httpClient , String agentUrl ) throws A2AClientError , A2AClientJSONError {
153+ public static AgentCard getAgentCard (HttpClient httpClient , String agentUrl ) throws A2AClientError , A2AClientJSONError {
155154 return getAgentCard (httpClient , agentUrl , null , null );
156155 }
157156
@@ -167,7 +166,7 @@ public static AgentCard getAgentCard(A2AHttpClient httpClient, String agentUrl)
167166 * @throws A2AClientJSONError f the response body cannot be decoded as JSON or validated against the AgentCard schema
168167 */
169168 public static AgentCard getAgentCard (String agentUrl , String relativeCardPath , Map <String , String > authHeaders ) throws A2AClientError , A2AClientJSONError {
170- return getAgentCard (new JdkA2AHttpClient ( ), agentUrl , relativeCardPath , authHeaders );
169+ return getAgentCard (HttpClient . createHttpClient ( agentUrl ), agentUrl , relativeCardPath , authHeaders );
171170 }
172171
173172 /**
@@ -182,7 +181,7 @@ public static AgentCard getAgentCard(String agentUrl, String relativeCardPath, M
182181 * @throws A2AClientError If an HTTP error occurs fetching the card
183182 * @throws A2AClientJSONError f the response body cannot be decoded as JSON or validated against the AgentCard schema
184183 */
185- public static AgentCard getAgentCard (A2AHttpClient httpClient , String agentUrl , String relativeCardPath , Map <String , String > authHeaders ) throws A2AClientError , A2AClientJSONError {
184+ public static AgentCard getAgentCard (HttpClient httpClient , String agentUrl , String relativeCardPath , Map <String , String > authHeaders ) throws A2AClientError , A2AClientJSONError {
186185 A2ACardResolver resolver = new A2ACardResolver (httpClient , agentUrl , relativeCardPath , authHeaders );
187186 return resolver .getAgentCard ();
188187 }
0 commit comments