Package com.easypost.easyvcr
Class HttpClients
java.lang.Object
com.easypost.easyvcr.HttpClients
HttpClient singleton for EasyVCR.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectnewClient(HttpClientType type, String url, Cassette cassette, Mode mode)Get a new client configured to use cassettes.static ObjectnewClient(HttpClientType type, String url, Cassette cassette, Mode mode, AdvancedSettings advancedSettings)Get a new client configured to use cassettes.static RecordableHttpsURLConnectionnewHttpsURLConnection(String url, Cassette cassette, Mode mode)Get a new RecordableHttpsURLConnection configured to use cassettes.static RecordableHttpsURLConnectionnewHttpsURLConnection(String url, Cassette cassette, Mode mode, AdvancedSettings advancedSettings)Get a new RecordableHttpsURLConnection configured to use cassettes.static RecordableHttpURLConnectionnewHttpURLConnection(String url, Cassette cassette, Mode mode)Get a new RecordableHttpURLConnection configured to use cassettes.static RecordableHttpURLConnectionnewHttpURLConnection(String url, Cassette cassette, Mode mode, AdvancedSettings advancedSettings)Get a new RecordableHttpURLConnection configured to use cassettes.
-
Constructor Details
-
HttpClients
public HttpClients()
-
-
Method Details
-
newClient
public static Object newClient(HttpClientType type, String url, Cassette cassette, Mode mode, AdvancedSettings advancedSettings) throws URISyntaxException, IOException, RecordingExpirationExceptionGet a new client configured to use cassettes.- Parameters:
type- HttpClientType type of client to create.url- String url to use when creating the client.cassette- Cassette to use when creating the client.mode- Mode to use when creating the client.advancedSettings- AdvancedSettings to use when creating the client.- Returns:
- Object client.
- Throws:
URISyntaxException- If the url is malformed.IOException- If there is an error creating the client.RecordingExpirationException
-
newClient
public static Object newClient(HttpClientType type, String url, Cassette cassette, Mode mode) throws URISyntaxException, IOException, RecordingExpirationExceptionGet a new client configured to use cassettes.- Parameters:
type- HttpClientType type of client to create.url- String url to use when creating the client.cassette- Cassette to use when creating the client.mode- Mode to use when creating the client.- Returns:
- Object client.
- Throws:
URISyntaxException- If the url is malformed.IOException- If there is an error creating the client.RecordingExpirationException
-
newHttpURLConnection
public static RecordableHttpURLConnection newHttpURLConnection(String url, Cassette cassette, Mode mode, AdvancedSettings advancedSettings) throws IOException, RecordingExpirationExceptionGet a new RecordableHttpURLConnection configured to use cassettes.- Parameters:
url- String url to use when creating the client.cassette- Cassette to use when creating the client.mode- Mode to use when creating the client.advancedSettings- AdvancedSettings to use when creating the client.- Returns:
- RecordableHttpURLConnection client.
- Throws:
IOException- If there is an error creating the client.RecordingExpirationException
-
newHttpURLConnection
public static RecordableHttpURLConnection newHttpURLConnection(String url, Cassette cassette, Mode mode) throws IOException, RecordingExpirationExceptionGet a new RecordableHttpURLConnection configured to use cassettes.- Parameters:
url- String url to use when creating the client.cassette- Cassette to use when creating the client.mode- Mode to use when creating the client.- Returns:
- RecordableHttpURLConnection client.
- Throws:
IOException- If there is an error creating the client.RecordingExpirationException
-
newHttpsURLConnection
public static RecordableHttpsURLConnection newHttpsURLConnection(String url, Cassette cassette, Mode mode, AdvancedSettings advancedSettings) throws IOException, RecordingExpirationExceptionGet a new RecordableHttpsURLConnection configured to use cassettes.- Parameters:
url- String url to use when creating the client.cassette- Cassette to use when creating the client.mode- Mode to use when creating the client.advancedSettings- AdvancedSettings to use when creating the client.- Returns:
- RecordableHttpsURLConnection client.
- Throws:
IOException- If there is an error creating the client.RecordingExpirationException
-
newHttpsURLConnection
public static RecordableHttpsURLConnection newHttpsURLConnection(String url, Cassette cassette, Mode mode) throws IOException, RecordingExpirationExceptionGet a new RecordableHttpsURLConnection configured to use cassettes.- Parameters:
url- String url to use when creating the client.cassette- Cassette to use when creating the client.mode- Mode to use when creating the client.- Returns:
- RecordableHttpsURLConnection client.
- Throws:
IOException- If there is an error creating the client.RecordingExpirationException
-