biz.neustar.wpm.api
Interface HttpClient


public interface HttpClient

The API that makes HTTP requests for Neustar Web Performance Management scripts. This class can be used directly to make HTTP requests. It is also used to proxy HTTP requests made by any real browser opened by test scripts. In both cases, requests to this API are logged in the transaction results, with timings for time-to-first-byte, DNS lookup, time-to-last-byte, etc captured. In addition to the basic GET/POST HTTP actions, this API provides many useful utilities to extend/modify the normal script or browser behavior. For example:


Method Summary
 void addPointOfFailureRequests(java.lang.String pattern)
          Emulate failing requests.
 void addRequestInterceptor(NativeFunction callback)
          Registers a callback function that will be triggered before every HTTP request is sent.
 void addResponseInterceptor(NativeFunction callback)
          Registers a callback function that will be triggered after every HTTP response is received.
 void autoBasicAuthorization(java.lang.String domain, java.lang.String username, java.lang.String password)
          Forces all requests to the specific domain ("example.com") or host ("www.example.com") to have the proper header necessary to automatically pass any BASIC authentication challenge (ie: the Authorization header) with the supplied username and password.
 void blacklistCommonUrls()
          Blacklist well-known sites that are commonly used for site analytics and advertising.
 void blacklistRealUserUrls()
          Blacklist Real User Measurement requests.
 void blacklistRequests(java.lang.String pattern, int responseCode)
          Blacklist any HTTP request that matches the supplied regular expression pattern, automatically registering the supplied response code as the response without actually making the call.
 void clearBlacklist()
          Clear any existing blacklist rules.
 void clearCookies()
          Remove all cookies.
 void clearDNSCache()
          Flushes the DNS cache used by this http client
 void clearWhitelist()
          Clear any existing whitelist rules.
 void configureSSL(java.lang.String sslAlgorithm)
          Allows setting of SSL version to use when connecting over HTTPS/SSL.
 void configureSSL(java.lang.String sslAlgorithm, boolean forceSSLCertificateVerification)
          Allows fine tuning of the SSL version to use when connecting over HTTPS/SSL.
 void createCookie(java.lang.String name, java.lang.String value, java.lang.String domain)
          Create a new cookie.
 void createCookie(java.lang.String name, java.lang.String value, java.lang.String domain, java.lang.String path)
          Create a new cookie.
 HttpResponse del(java.lang.String url)
          Issues an HTTP DELETE without any content verification.
 HttpResponse del(java.lang.String url, NativeObject verifyParams)
          Issues an HTTP DELETE with a parameter for text/status code/location verification.
 HttpResponse get(java.lang.String url)
          Issues an HTTP GET without any content verification.
 HttpResponse get(java.lang.String url, NativeObject verifyParams)
          Issues an HTTP GET with a parameter for text/status code/location verification.
 Cookie getCookie(java.lang.String name)
          Retrieve a cookie by name.
 Cookie getCookie(java.lang.String name, java.lang.String domain)
          Retrieve a cookie by name.
 Cookie getCookie(java.lang.String name, java.lang.String domain, java.lang.String path)
          Retrieve a cookie by name.
 boolean getEnableSNI()
          Returns if SSL SNI (Server Name Indication) is enabled or disabled.
 HttpResponse head(java.lang.String url)
          Issues an HTTP HEAD without any verification.
 HttpResponse head(java.lang.String url, NativeObject verifyParams)
          Issues an HTTP HEAD with a parameter for status code/location verification.
 HttpRequest newDelete(java.lang.String url)
          Creates a new DELETE request that can be further modified before finally executed.
 HttpRequest newGet(java.lang.String url)
          Creates a new GET request that can be further modified before finally executed.
 HttpRequest newHead(java.lang.String url)
          Creates a new HEAD request that can be further modified before finally executed.
 HttpRequest newOptions(java.lang.String url)
          Creates a new OPTIONS request that can be further modified before finally executed.
 HttpRequest newPatch(java.lang.String url)
          Creates a new PATCH request that can be further modified before finally executed.
 HttpRequest newPost(java.lang.String url)
          Creates a new POST request that can be further modified before finally executed.
 HttpRequest newPut(java.lang.String url)
          Creates a new PUT request that can be further modified before finally executed.
 HttpRequest newTrace(java.lang.String url)
          Creates a new TRACE request that can be further modified before finally executed.
 HttpResponse options(java.lang.String url)
          Issues an HTTP OPTIONS without any content verification.
 HttpResponse options(java.lang.String url, NativeObject verifyParams)
          Issues an HTTP OPTIONS with a parameter for text/status code/location verification.
 HttpResponse post(java.lang.String url)
          Issues an HTTP POST with a parameter for text/status code/location verification.
 HttpResponse post(java.lang.String url, NativeObject verifyParams)
          Issues an HTTP POST with a parameter for text/status code/location verification.
 HttpResponse put(java.lang.String url, NativeObject verifyParams)
          Issues an HTTP PUT with a parameter for text/status code/location verification.
 void remapHost(java.lang.String source, java.lang.String target)
          Provides functionality similar to editing your "hosts file" on your local computer.
 void rewriteUrl(java.lang.String match, java.lang.String replace)
          Tells the browser to rewrite any URL it encounters using the provided regular expression and replacement string.
 void setCheckValidSSL(boolean checkValidSSL)
          Turn SSL certificate validation on or off when going through the proxy or making HTTP requests directly.
 void setConnectionTimeout(int connectionTimeout)
          Sets the timeout for the connection to be established.
 void setDNSCacheTimeout(int timeout)
          Sets the TTL for objects in the DNS cache in seconds.
 void setEnableSNI(boolean enable)
          Enabled or disable SSL SNI (Server Name Indication).
 void setFollowRedirects(boolean followRedirects)
          Tells the HttpClient whether redirects (300 status codes) should automatically be followed.
 void setRequestTimeout(int requestTimeout)
          Sets the request timeout for all subsequent HTTP requests.
 void setRetryCount(int count)
          Set the automatic retry count for HTTP requests (both requests made directly and request made by the browser).
 void setSocketOperationTimeout(int socketOperationTimeout)
          Sets the timeout for a socket operation, such as reading a byte from the HTTP stream (SO_TIMEOUT).
 void useClientCertificates(java.lang.String keystoreType, java.lang.String keystoreFilename, java.lang.String keystorePassword)
          Configures the HttpClient to use client certificates.
 void whitelistRequests(java.lang.String[] patterns, int responseCode)
          Whitelist any HTTP request that matches the supplied regular expression patterns, automatically registering the supplied response code as the response for any request not in the set of whitelists.
 

Method Detail

setRetryCount

void setRetryCount(int count)
Set the automatic retry count for HTTP requests (both requests made directly and request made by the browser). A request will be retried if the connection is dropped or interrupted in any way. By default this is 0, following the similar behavior of most modern web browsers.

Parameters:
count - the number of times to retry an HTTP request (0 by default)

remapHost

void remapHost(java.lang.String source,
               java.lang.String target)
Provides functionality similar to editing your "hosts file" on your local computer. This can be used to map a domain to an IP address or alternative domain that isn't yet in the public DNS records. This is great for testing websites that aren't yet public.

Parameters:
source - the source host to re-map from (ie: www.example.com)
target - the target host to re-map to (ie: new.example.com)

addRequestInterceptor

void addRequestInterceptor(NativeFunction callback)
Registers a callback function that will be triggered before every HTTP request is sent. Useful to manipulate a request before is sent to the target HTTP server. Multiple calls to this method will register multiple callback function (ensure this is the behaviour you want). Usage example:
 c.addRequestInterceptor(function(request) {
     // do something to the request object
 });
 
The request argument in your callback function has it's own set of functions that you can use to add/remove/edit headers and get the requesting URL. Consult the API documentation for the underlying library used (Apache HTTP Client) to see all the functions available to you.

Parameters:
callback - Javascript callback function

addResponseInterceptor

void addResponseInterceptor(NativeFunction callback)
Registers a callback function that will be triggered after every HTTP response is received. Useful to manipulate the response of an HTTP request before is passed to the original client. Multiple calls to this method will register multiple callback function (ensure this is the behaviour you want). Usage example:
 c.addResponseInterceptor(function(response) {
     // do something to the response object
 });
 
The response argument in your callback function has it's own set of functions that you can use to add/remove/edit headers and get the requesting URL. Consult the API documentation for the underlying library used (Apache HTTP Client) to see all the functions available to you.

Parameters:
callback - Javascript callback function

autoBasicAuthorization

void autoBasicAuthorization(java.lang.String domain,
                            java.lang.String username,
                            java.lang.String password)
Forces all requests to the specific domain ("example.com") or host ("www.example.com") to have the proper header necessary to automatically pass any BASIC authentication challenge (ie: the Authorization header) with the supplied username and password.

Parameters:
domain - the domain or host to auto authenticate
username - the username to login with
password - the password to login with

createCookie

void createCookie(java.lang.String name,
                  java.lang.String value,
                  java.lang.String domain)
Create a new cookie.

Parameters:
name - the cookie name
value - the cookie value
domain - the domain the cookie will be used

createCookie

void createCookie(java.lang.String name,
                  java.lang.String value,
                  java.lang.String domain,
                  java.lang.String path)
Create a new cookie.

Parameters:
name - the cookie name
value - the cookie value
domain - the domain the cookie will be used
path - the path the cookie will be used

clearCookies

void clearCookies()
Remove all cookies.


getCookie

Cookie getCookie(java.lang.String name)
Retrieve a cookie by name. The first cookie matching the name will be returned.

Parameters:
name - the name of the cookie
Returns:
the cookie object

getCookie

Cookie getCookie(java.lang.String name,
                 java.lang.String domain)
Retrieve a cookie by name. The first cookie matching both name and domain will be returned.

Parameters:
name - the name of the cookie
domain - the domain for which the cookie is valid
Returns:
the cookie object

getCookie

Cookie getCookie(java.lang.String name,
                 java.lang.String domain,
                 java.lang.String path)
Retrieve a cookie by name. If domain or path are not null, they must match the cookie values exactly.

Parameters:
name - the name of the cookie
domain - the domain for which the cookie is valid
path - the subset of URLs on the origin server to which this cookie applies
Returns:
the cookie object

rewriteUrl

void rewriteUrl(java.lang.String match,
                java.lang.String replace)
Tells the browser to rewrite any URL it encounters using the provided regular expression and replacement string. For example, if the match parameter is "http://my-ad-vendor\.com/" and the replacement string is "http://example.com/mock_ads/", then when the browser tries to load http://my-ad-vendor.com/foo.js it would actually end up requesting http://example.com/mock_ads/foo.js. This is very useful for when you can't change the underlying site by want to remap one request to another or possibly even force some requests to never make it to their intended destination (ie: perfect for site analytics packages when you don't want your scripts causing un-realistic traffic patterns).

Parameters:
match - the regular expression string to match against. You can use regex symbols such as ".", "\d", "\W", "[...]", etc.
replace - the plain text string to replace any matching subsection of a URL handled by the browser.

blacklistRequests

void blacklistRequests(java.lang.String pattern,
                       int responseCode)
Blacklist any HTTP request that matches the supplied regular expression pattern, automatically registering the supplied response code as the response without actually making the call. The response time for these requests will always be 0 ms. These requests will also not be matched against any automatic "expected response code" validation, even if one was supplied before making the request. For example, to prevent Google Analytics requests from being issued, you could do the following:
 c.blacklistRequests("http://www\\.google-analytics\\.com/.*", 200);
 

Parameters:
pattern - the regular expression string to match against. You can use regex symbols such as ".", "\d", "\W", "[...]", etc.
responseCode - the HTTP response code to immediately "return" instead of making the actual HTTP request.

blacklistCommonUrls

void blacklistCommonUrls()
Blacklist well-known sites that are commonly used for site analytics and advertising. Most website monitoring scripts will want to exclude these so that analytics are not messed up. This is currently a shortcut for the following:
   c.blacklistRequests("http(s)?://[^/]+\\.google-analytics\\.com/.*", 200);
   c.blacklistRequests("http://[^/]+\\.quantserve\\.com/.*", 200);
   c.blacklistRequests("http://www\\.quantcast\\.com/.*", 200);
   c.blacklistRequests("http://c\\.compete\\.com/.*", 200);
   c.blacklistRequests("http(s)?://s?b\\.scorecardresearch\\.com/.*", 200);
   c.blacklistRequests("http://s\\.stats\\.wordpress\\.com/.*", 200);
   c.blacklistRequests("http://partner\\.googleadservices\\.com/.*", 200);
   c.blacklistRequests("http://ad\\.adtegrity\\.net/.*", 200);
   c.blacklistRequests("http(s)?://[^/]+\\.doubleclick\\.net/.*", 200);
   c.blacklistRequests("http(s)?://connect\\.facebook\\.net/.*", 200);
   c.blacklistRequests("http://platform\\.twitter\\.com/.*", 200);
   c.blacklistRequests("http://[^/]+\\.addthis\\.com/.*", 200);
   c.blacklistRequests("http://widgets\\.digg\\.com/.*", 200);
   c.blacklistRequests("http(s)?://plus\\.google\\.com/.*", 200);
   c.blacklistRequests("http(s)?://plusone\\.google\\.com/.*", 200);
 


blacklistRealUserUrls

void blacklistRealUserUrls()
Blacklist Real User Measurement requests. If your website has the RUM tag, the step time reported by our agents might be affected by those requests, if waitForNetworkTrafficToStop is used. This is currently a shortcut for the following:
   c.blacklistRequests("http(s)?://d2lo2tipcl3aii.cloudfront.net/.*", 200);
 


clearBlacklist

void clearBlacklist()
Clear any existing blacklist rules.


addPointOfFailureRequests

void addPointOfFailureRequests(java.lang.String pattern)
Emulate failing requests. Very useful to see whether a 3rd party resource included in a page might significantly increases the load time of that page if that resource becomes unavailable. For example, to simulate failing Google Analytics requests, you could do the following:
 c.addPointOfFailureRequests("http://www\\.google-analytics\\.com/.*");
 


whitelistRequests

void whitelistRequests(java.lang.String[] patterns,
                       int responseCode)
Whitelist any HTTP request that matches the supplied regular expression patterns, automatically registering the supplied response code as the response for any request not in the set of whitelists. The response time for those requests will always be 0 ms. Those requests will also not be matched against any automatic "expected response code" validation, even if one was supplied before making the request. For example, to prevent all 3rd party requests from being made and to only allow requests to www.example.com and images.example.com, you would do:
 c.whitelistRequests(["http://www\\.example\\.com/.*", "http://images\\.example.com\\.com/.*"], 200);
 

Parameters:
patterns - the array regular expression string to match against. You can use regex symbols such as ".", "\d", "\W", "[...]", etc.
responseCode - the HTTP response code to immediately "return" instead of making the actual HTTP request.

clearWhitelist

void clearWhitelist()
Clear any existing whitelist rules.


get

HttpResponse get(java.lang.String url)
Issues an HTTP GET without any content verification.

Parameters:
url - the URL to make an HTTP GET request to.
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

get

HttpResponse get(java.lang.String url,
                 NativeObject verifyParams)
Issues an HTTP GET with a parameter for text/status code/location verification. Verify Params:
     c.get("http://google.com", {
         text: "Google",
         statusCode: 301,
         location: "http://www.google.com/"
     });
 

Parameters:
url - the URL to make an HTTP GET request to.
verifyParams - the verification parameters to check
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

post

HttpResponse post(java.lang.String url)
Issues an HTTP POST with a parameter for text/status code/location verification.

Parameters:
url - the URL to make an HTTP POST request to.
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

post

HttpResponse post(java.lang.String url,
                  NativeObject verifyParams)
Issues an HTTP POST with a parameter for text/status code/location verification. Verify Params:
     c.post("http://your_site", {
         text: "Search Text",
         statusCode: 301,
         location: "http://expectedLocation",
         params: {
             user: "foo",
             password: "bar"
         }
     });
 

Parameters:
url - the URL to make an HTTP POST request to.
verifyParams - the verification parameters to check
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

put

HttpResponse put(java.lang.String url,
                 NativeObject verifyParams)
Issues an HTTP PUT with a parameter for text/status code/location verification. Verify Params:
     c.put("http://your_site", {
         text: "Search Text",
         statusCode: 301,
         location: "http://expectedLocation",
         params: {
             user: "foo",
             password: "bar",
             other_param: ['hello', 'world']
         }
     });
 

Parameters:
url - the URL to make an HTTP PUT request to.
verifyParams - the verification parameters to check
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

del

HttpResponse del(java.lang.String url)
Issues an HTTP DELETE without any content verification.

Parameters:
url - the URL to make an HTTP DELETE request to.
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

del

HttpResponse del(java.lang.String url,
                 NativeObject verifyParams)
Issues an HTTP DELETE with a parameter for text/status code/location verification. Verify Params:
     c.del("http://your_site", {
         text: "Search Text",
         statusCode: 301,
         location: "http://expectedLocation"
     });
 

Parameters:
url - the URL to make an HTTP DELETE request to.
verifyParams - the verification parameters to check
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

options

HttpResponse options(java.lang.String url)
Issues an HTTP OPTIONS without any content verification.

Parameters:
url - the URL to make an HTTP OPTIONS request to.
Returns:
an object that contains the detailed object results (status code, timings, etc)

options

HttpResponse options(java.lang.String url,
                     NativeObject verifyParams)
Issues an HTTP OPTIONS with a parameter for text/status code/location verification. Verify Params:
     c.options("http://your_site", {
         text: "Search Text",
         statusCode: 301,
         location: "http://expectedLocation"
     });
 

Parameters:
url - the URL to make an HTTP OPTIONS request to.
verifyParams - the verification parameters to check
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

head

HttpResponse head(java.lang.String url)
Issues an HTTP HEAD without any verification.

Parameters:
url - the URL to make an HTTP HEAD request to.
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

head

HttpResponse head(java.lang.String url,
                  NativeObject verifyParams)
Issues an HTTP HEAD with a parameter for status code/location verification. Verify Params:
     c.head("http://your_site", {
         statusCode: 301,
         location: "http://expectedLocation"
     });
 

Parameters:
url - the URL to make an HTTP HEAD request to.
verifyParams - the verification parameters to check
Returns:
an object that contains the detailed object results (status code, timings, etc) and whether content verification matched.

setFollowRedirects

void setFollowRedirects(boolean followRedirects)
Tells the HttpClient whether redirects (300 status codes) should automatically be followed. By default this is true.

Parameters:
followRedirects - true for redirects to be followed.

setRequestTimeout

void setRequestTimeout(int requestTimeout)
Sets the request timeout for all subsequent HTTP requests. The request timeout is the overall time it takes to complete an HTTP request. By default, this value is set to -1, which means there is no timeout and HTTP requests can continue forever provided they don't contain a socket operation timeout (SO_TIMEOUT) or connection timeout.

Parameters:
requestTimeout - the timeout value, in milliseconds, to use.

setSocketOperationTimeout

void setSocketOperationTimeout(int socketOperationTimeout)
Sets the timeout for a socket operation, such as reading a byte from the HTTP stream (SO_TIMEOUT). The default value for this setting is 30000, which is 30 seconds.

Parameters:
socketOperationTimeout - the timeout value, in milliseconds, to use.

setConnectionTimeout

void setConnectionTimeout(int connectionTimeout)
Sets the timeout for the connection to be established. The default value for this setting is 30000, which is 30 seconds.

Parameters:
connectionTimeout - the timeout value, in milliseconds, to use.

newGet

HttpRequest newGet(java.lang.String url)
Creates a new GET request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP GET request to.
Returns:
an object representing the HTTP GET request that will be executed in the future.

newPost

HttpRequest newPost(java.lang.String url)
Creates a new POST request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP POST request to.
Returns:
an object representing the HTTP POST request that will be executed in the future.

newPut

HttpRequest newPut(java.lang.String url)
Creates a new PUT request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP PUT request to.
Returns:
an object representing the HTTP PUT request that will be executed in the future.

newDelete

HttpRequest newDelete(java.lang.String url)
Creates a new DELETE request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP DELETE request to.
Returns:
an object representing the HTTP DELETE request that will be executed in the future.

newOptions

HttpRequest newOptions(java.lang.String url)
Creates a new OPTIONS request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP OPTIONS request to.
Returns:
an object representing the HTTP OPTIONS request that will be executed in the future.

newHead

HttpRequest newHead(java.lang.String url)
Creates a new HEAD request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP HEAD request to.
Returns:
an object representing the HTTP HEAD request that will be executed in the future.

newPatch

HttpRequest newPatch(java.lang.String url)
Creates a new PATCH request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP PATCH request to.
Returns:
an object representing the HTTP PATCH request that will be executed in the future.

newTrace

HttpRequest newTrace(java.lang.String url)
Creates a new TRACE request that can be further modified before finally executed.

Parameters:
url - the URL to make an HTTP TRACE request to.
Returns:
an object representing the HTTP TRACE request that will be executed in the future.

clearDNSCache

void clearDNSCache()
Flushes the DNS cache used by this http client


setDNSCacheTimeout

void setDNSCacheTimeout(int timeout)
Sets the TTL for objects in the DNS cache in seconds. Notice that -1 represents cache forever and 0 will effectively disable it

Parameters:
timeout - timeout in seconds

setCheckValidSSL

void setCheckValidSSL(boolean checkValidSSL)
Turn SSL certificate validation on or off when going through the proxy or making HTTP requests directly. By default bad SSL certs are ignored. Example of turning SSL checking on (the following script will fail if the SSL cert is not valid):
 var driver = test.openWebDriver();
 var c = test.openHttpClient();
 c.setCheckValidSSL(true);
 test.beginTransaction();
 test.beginStep("Goto https://www.mysite.com but only if the SSL is valid");
 driver.get("https://www.mysite.com");
 test.endStep();
 test.endTransaction();
 
You can wrap HTTP-generating calls in a try-catch block to capture the exception and let your script continue.

Parameters:
checkValidSSL - when set to true all SSL certs must be valid or the transaction will fail.

configureSSL

void configureSSL(java.lang.String sslAlgorithm)
Allows setting of SSL version to use when connecting over HTTPS/SSL. Acceptable values for sslAlgorithm: TLSv1 is the default as this is the most widely supported, for backward compatibility you can force a particular TLS or SSL version. TLSv1 will allow connections to be made via TLSv1.0, TLSv1.1 or TLSv1.2. SSLv2Hello is available for servers that reject the SSLv3/TLS ClientHello requests. This doesn't mean the connection is over SSLv2, this setting wraps the initial SSLv3 connection packet in an SSLv2 ClientHello. The server and client will use SSLv3 after this packet is sent if the server accepts the SSLv2 ClientHello message.

Parameters:
sslAlgorithm - the SSL algorithm to use when connecting to your HTTPS enabled site.

configureSSL

void configureSSL(java.lang.String sslAlgorithm,
                  boolean forceSSLCertificateVerification)
Allows fine tuning of the SSL version to use when connecting over HTTPS/SSL. Acceptable values for sslAlgorithm: TLSv1 is the default as this is the most widely supported, for backward compatibility you can force a particular TLS or SSL version. TLSv1 will allow connections to be made via TLSv1.0, TLSv1.1 or TLSv1.2. SSLv2Hello is available for servers that reject the SSLv3/TLS ClientHello requests. This doesn't mean the connection is over SSLv2, this setting wraps the initial SSLv3 connection packet in an SSLv2 ClientHello. The server and client will use SSLv3 after this packet is sent if the server accepts the SSLv2 ClientHello message. The forceSSLCertificateVerification flag controls whether your server's SSL certificate will be verified like most browsers tend to do. If this is set to false (the default), then SSL certificate warnings and errors (mismatched common name, expired cert, etc) will be ignored. If this is set to true, then HTTP requests will fail if the certificate cannot be verified.

Parameters:
sslAlgorithm - the SSL algorithm to use when connecting to your HTTPS enabled site.
forceSSLCertificateVerification - true to force ssl certificate verification, false to be relaxed and ignore certificate warnings

useClientCertificates

void useClientCertificates(java.lang.String keystoreType,
                           java.lang.String keystoreFilename,
                           java.lang.String keystorePassword)
Configures the HttpClient to use client certificates. The keystore should be uploaded as a datafile and it must be in either a JKS or PKCS12 format. Note: the PrivateKeyEntries within the keystore must have the same password as the password for the keystore itself.

Parameters:
keystoreType - either "JKS" or "PKCS12"
keystoreFilename - the name of the keystore datafile
keystorePassword - the password that was provided to the keytool when the keystore was created

setEnableSNI

void setEnableSNI(boolean enable)
Enabled or disable SSL SNI (Server Name Indication). SNI is enabled by default. Disable SNI if 'handshake alert: unrecognized_name:' is returned when connecting to the server. Web servers that are not configured with the correct name will report this, so fixing the server name on the server will also fix the issue.

Parameters:
enable -

getEnableSNI

boolean getEnableSNI()
Returns if SSL SNI (Server Name Indication) is enabled or disabled. SNI is enabled by default.

Returns:
true if SNI is enabled, false otherwise.

Copyright © 2014 Neustar, Inc. All Rights Reserved.