protected HttpClient createHttpClient() {
        DefaultHttpClient client = new DefaultHttpClient();
        client.getParams().setParameter(AllClientPNames.USER_AGENT,
                "alliancetechrest-java library");
        if (UtilityMethods.isValidString(getUsername())
                && UtilityMethods.isValidString(getPassword())) {
            CredentialsProvider credProvider = new BasicCredentialsProvider();
            credProvider.setCredentials(new AuthScope(getHost(getHostname()),
                    AuthScope.ANY_PORT), new UsernamePasswordCredentials(getUsername(),
                    getPassword()));
            client.setCredentialsProvider(credProvider);
        }
        return client;
    }