Package eliasstar.jsonrpc
Class JsonRpc
- java.lang.Object
-
- eliasstar.jsonrpc.JsonRpc
-
public final class JsonRpc extends Object
This facade can be used to get started quickly and easily with sending RPC requests.- Since:
- 0.1.0
- Author:
- Elias*
-
-
Constructor Summary
Constructors Constructor Description JsonRpc()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Connection
connect(String url)
Connects to a RPC service.static Connection
connect(String url, Duration requestTimeout)
Connects to a RPC service.static void
setConnectionTimeout(Duration connectTimeout)
Sets the timeout for a new connection attempt.static void
setHttpVersion(HttpClient.Version http)
Sets the HTTP version used by the client.static void
setRedirectPolicy(HttpClient.Redirect policy)
Sets the redirect policy used for requests.
-
-
-
Method Detail
-
connect
public static Connection connect(String url)
Connects to a RPC service.Creates a
Connection
with default settings.Requests will time out after a minute.
- Parameters:
url
- The url of the RPC service- Returns:
- A
Connection
object for sending requests
-
connect
public static Connection connect(String url, Duration requestTimeout)
Connects to a RPC service.Creates a
Connection
with default settings.- Parameters:
url
- The url of the RPC servicerequestTimeout
- TheDuration
until a request will timeout- Returns:
- A
Connection
object for sending requests
-
setConnectionTimeout
public static void setConnectionTimeout(Duration connectTimeout)
Sets the timeout for a new connection attempt.- Parameters:
connectTimeout
- TheDuration
until a connection will timeout
-
setRedirectPolicy
public static void setRedirectPolicy(HttpClient.Redirect policy)
Sets the redirect policy used for requests.- Parameters:
policy
- The Policy
-
setHttpVersion
public static void setHttpVersion(HttpClient.Version http)
Sets the HTTP version used by the client.- Parameters:
http
- The version
-
-