All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mailersend.sdk.util.MailerSendHttpClientFactory Maven / Gradle / Ivy

/*************************************************
 * MailerSend Java SDK
 * https://github.com/mailersend/mailersend-java
 * 
 * @author MailerSend 
 * https://mailersend.com
 **************************************************/
package com.mailersend.sdk.util;

import java.net.http.HttpClient;

/**
 * We use a factory for the HttpClient that the SDk uses so that we can switch clients when needed
 * e.g. when running tests we use the HttpClientVcr to record and replay the API responses
 *
 * @author mailersend
 * @version $Id: $Id
 */
public class MailerSendHttpClientFactory {
	
	private static MailerSendHttpClientFactory instance = null;
	
	private HttpClient client;
	
	/**
	 * 

Getter for the field instance.

* * @return a {@link com.mailersend.sdk.util.MailerSendHttpClientFactory} object. */ public static MailerSendHttpClientFactory getInstance() { if (instance == null) { instance = new MailerSendHttpClientFactory(); } return instance; } /** *

createClient.

* * @return a HttpClient object. */ public HttpClient createClient() { if (client != null) { return client; } return HttpClient.newHttpClient(); } /** *

Setter for the field client.

* * @param client a HttpClient object. */ public void setClient(HttpClient client) { this.client = client; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy