// Path: NetLicensingClient/src/main/java/com/labs64/netlicensing/exception/RestException.java
// public class RestException extends NetLicensingException {
// 
//     private static final long serialVersionUID = -3863879794574523844L;
// 
//     /**
//      * Construct a <code>RestException</code> with the specified detail message.
//      * 
//      * @param msg
//      *            the detail message
//      */
//     public RestException(final String msg) {
//         super(msg);
//     }
// 
//     /**
//      * Construct a <code>RestException</code> with the specified detail message and cause exception.
//      * 
//      * @param msg
//      *            the detail message
//      * @param cause
//      *            the cause exception
//      */
//     public RestException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// 
// }
// 
// Path: NetLicensingClient/src/main/java/com/labs64/netlicensing/provider/auth/Authentication.java
// public interface Authentication {
// 	
// 	String getUsername();
// 	
// 	String getPassword();
// 
// }


import java.util.Map;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.NoContentException;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import com.labs64.netlicensing.exception.RestException;
import com.labs64.netlicensing.provider.auth.Authentication;
            synchronized (RestProviderJersey.class) {
                if (client == null) {
                    client = ClientBuilder.newClient(new ClientConfig());
                    if (configuration.isLoggingEnabled()) {
                        //TODO: enable logging for jersey 2.26
                        //client.register(new LoggingFilter());
                    }
                }
            }
        }
        return client;
    }

    /**
     * Get the RESTful client target
     *
     * @param basePath
     *            base provider path
     * @return RESTful client target
     */
    private WebTarget getTarget(final String basePath) {
        return getClient(getConfiguration()).target(basePath);
    }

    /**
     * @param target
     *            target object, to which the authentication headers will be added
     * @param auth
     *            an object providing the authentication info
     */
// Path: NetLicensingClient/src/main/java/com/labs64/netlicensing/exception/RestException.java
// public class RestException extends NetLicensingException {
// 
//     private static final long serialVersionUID = -3863879794574523844L;
// 
//     /**
//      * Construct a <code>RestException</code> with the specified detail message.
//      * 
//      * @param msg
//      *            the detail message
//      */
//     public RestException(final String msg) {
//         super(msg);
//     }
// 
//     /**
//      * Construct a <code>RestException</code> with the specified detail message and cause exception.
//      * 
//      * @param msg
//      *            the detail message
//      * @param cause
//      *            the cause exception
//      */
//     public RestException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// 
// }
// 
// Path: NetLicensingClient/src/main/java/com/labs64/netlicensing/provider/auth/Authentication.java
// public interface Authentication {
// 	
// 	String getUsername();
// 	
// 	String getPassword();
// 
// }


// Path: NetLicensingClient/src/main/java/com/labs64/netlicensing/provider/RestProviderJersey.java
import java.util.Map;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.NoContentException;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import com.labs64.netlicensing.exception.RestException;
import com.labs64.netlicensing.provider.auth.Authentication;

            synchronized (RestProviderJersey.class) {
                if (client == null) {
                    client = ClientBuilder.newClient(new ClientConfig());
                    if (configuration.isLoggingEnabled()) {
                        //TODO: enable logging for jersey 2.26
                        //client.register(new LoggingFilter());
                    }
                }
            }
        }
        return client;
    }

    /**
     * Get the RESTful client target
     *
     * @param basePath
     *            base provider path
     * @return RESTful client target
     */
    private WebTarget getTarget(final String basePath) {
        return getClient(getConfiguration()).target(basePath);
    }

    /**
     * @param target
     *            target object, to which the authentication headers will be added
     * @param auth
     *            an object providing the authentication info
     */
    private void addAuthHeaders(final WebTarget target, final Authentication auth) {