Feature: A2aHttpTransport server-mode HTTP transport
  As an A2A client, I want to communicate with remote agents via HTTP(S)
  using JSON-RPC 2.0 message framing.

  Scenario Outline: Transport connect accepts valid base URLs
    Given a new A2aHttpTransport
    When I try to connect via the transport to "<url>"
    Then the transport should be connected when using url
    Examples:
      | url                              |
      | http://localhost:8080            |
      | https://localhost:8443           |
      | http://server.example.com/       |
      | https://a2a.cleverthis.com/api/|

  Scenario Outline: Transport connect rejects invalid base URLs
    Given a new A2aHttpTransport
    When I try to connect via the transport to "<url>"
    Then an A2aValueError should be raised with message containing "<reason>"
    Examples:
      | url                       | reason               |
      | ""                        | empty string         |
      | "ftp://localhost:8080"    | invalid scheme       |
      | None                      | not a non-empty string|

  Scenario: Transport send requires A2aRequest instance
    Given a new A2aHttpTransport
    When the transport is connected to "http://localhost:8080"
    And I try to send a non-A2aRequest via the transport
    Then an A2aTypeError should be raised for the transport

  Scenario: Transport send while disconnected raises RuntimeError  
    Given a new A2aHttpTransport
    When I try to send a request via the unconnected transport
    Then an A2aRuntimeError should be raised for the transport

  Scenario: Server response is parsed successfully (mocked)
    Given a new A2aHttpTransport
    When the transport is connected to "http://localhost:8080"
    And HTTP responses are mocked with JSON-RPC success response
    And I send a request <request_method> via the transport
    Then the response has no error
  
  Scenario: Server returns HTTP 500 error (mocked)
    Given a new A2aHttpTransport  
    When the transport is connected to "http://localhost:8080"
    And HTTP responses are mocked with HTTP 500 status
    And I send a request <request_method> via the transport
    Then the response has an error
  
  Scenario: Transport disconnect after connect clears state
    Given a new A2aHttpTransport
    When the transport is connected to "http://localhost:8080"
    Then the transport should be connected when using url
    And I disconnect the transport
    Then the transport should not be connected
