Interface RpcTransport

All Known Implementing Classes:
NetworkTransport

public interface RpcTransport

The one HTTP exchange every chain client needs: send a body, read the reply. The clients in this package are written against this interface alone, so the same EvmRpc, EsploraClient and SolanaRpc run in an application and on the backend:

  • in an application, NetworkTransport sends through the NetworkManager;
  • on the backend, com.codename1.backend.WebRpcTransport sends through its WebClient.

A test passes its own implementation that answers recorded replies.

Every call blocks until the reply arrives. On the EDT the application transport waits with invokeAndBlock, as NetworkManager.addToQueueAndWait does, so the UI keeps painting.

  • Method Summary

    Modifier and Type
    Method
    Description
    send(String method, String url, String contentType, String body)
    Sends one request and answers the response body.
  • Method Details

    • send

      String send(String method, String url, String contentType, String body) throws IOException

      Sends one request and answers the response body.

      Parameters
      • method: GET or POST
      • url: the full URL
      • contentType: the body's media type, or null for a request without one
      • body: the body, or null
      Throws
      • RpcException: for a status outside 2xx, with the status and the body the server sent
      • IOException: when the request could not be made at all
      Throws:
      IOException