Class HTTPClientWrapper


  • public class HTTPClientWrapper
    extends java.lang.Object
    A wrapper to support instances of com.dkfqs.tools.http.HTTPClient.
    • Constructor Summary

      Constructors 
      Constructor Description
      HTTPClientWrapper​(com.dkfqs.measuringagent.javascript.JavaScriptRhinoTestJobExecutorContext testJobExecutorContext, com.dkfqs.measuringagent.javascript.executor.ExecutorConsoleLog executorConsoleLog)
      Create a new instance of this wrapper.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close​(HTTPClient httpClient)
      Free all internal resources and close all connections of the HTTPClient.
      void closeAbortAllClients()
      Free all internal resources and close all connections of the HTTPClients.
      static javax.net.ssl.KeyManager[] getClientAuthKeyManagers​(java.lang.String clientCertificateContentB64, java.lang.String clientCertificatePasswordB64)
      Get the key managers of a PKCS12 client certificate
      static HTTPRequestContent newHTTPRequestContent()
      Create a new (empty) instance of an HTTP request content.
      static HTTPRequestContent newHTTPRequestContent​(java.lang.String content)
      Create an initialized instance of an HTTP request content.
      HTTPClient newInstance()
      Create a new instance of an HTTP client with 2 processing threads and a default processing timeout of 30 seconds.
      HTTPClient newInstance​(int processingTimeout, int numProcessingThreads)
      Create a new instance of an HTTP client.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTTPClientWrapper

        public HTTPClientWrapper​(com.dkfqs.measuringagent.javascript.JavaScriptRhinoTestJobExecutorContext testJobExecutorContext,
                                 com.dkfqs.measuringagent.javascript.executor.ExecutorConsoleLog executorConsoleLog)
        Create a new instance of this wrapper.
        Parameters:
        testJobExecutorContext - the test job executor context
        executorConsoleLog - the console log
    • Method Detail

      • newInstance

        public HTTPClient newInstance()
        Create a new instance of an HTTP client with 2 processing threads and a default processing timeout of 30 seconds.
        Returns:
        the new instance of an HTTP client
        See Also:
        JavaScriptRhinoTestJobExecutorContext.getJavaScriptHTTPClientMaxInstances()
      • newInstance

        public HTTPClient newInstance​(int processingTimeout,
                                      int numProcessingThreads)
        Create a new instance of an HTTP client.
        Parameters:
        processingTimeout - the processing timeout per URL at HTTP level in millisecond
        numProcessingThreads - the number processing threads, valid range is = 1..64
        Returns:
        the new instance of an HTTP client
      • getClientAuthKeyManagers

        public static javax.net.ssl.KeyManager[] getClientAuthKeyManagers​(java.lang.String clientCertificateContentB64,
                                                                          java.lang.String clientCertificatePasswordB64)
                                                                   throws java.lang.Exception
        Get the key managers of a PKCS12 client certificate
        Parameters:
        clientCertificateContentB64 - the binary content of the PKCS12 client certificate in base64 format
        clientCertificatePasswordB64 - the password of the PKCS12 client certificate in base64 format
        Returns:
        the key managers of thr PKCS12 client certificate
        Throws:
        java.lang.Exception - if the PKCS12 client certificate cannot be loaded
      • newHTTPRequestContent

        public static HTTPRequestContent newHTTPRequestContent()
        Create a new (empty) instance of an HTTP request content.
        Returns:
        the new (empty) instance of an HTTP request content
      • newHTTPRequestContent

        public static HTTPRequestContent newHTTPRequestContent​(java.lang.String content)
        Create an initialized instance of an HTTP request content.
        Parameters:
        content - the HTTP request content in UTF-8 text format.
        Returns:
        the initialized instance of an HTTP request content.
      • close

        public void close​(HTTPClient httpClient)
        Free all internal resources and close all connections of the HTTPClient.
        Parameters:
        httpClient - the HTTP client
      • closeAbortAllClients

        public void closeAbortAllClients()
        Free all internal resources and close all connections of the HTTPClients. This will also abort any pending HTTP requests.