Client (Apache Geode 1.7.0)
Date: 2018-09-27

org.apache.geode.session.tests

## Class Client

- java.lang.Object
- - org.apache.geode.session.tests.Client

-     public class Client
      extends java.lang.Object

  A simple http client that talks to a server running the session-testing-war. This client sends commands to the `CommandServlet` over http to modify session properties and returns the results. The client has support for connecting to multiple servers and sending the session cookie returned by one server to other servers, to emulate the behavior of a client talking to the servers through a load balancer. The client currently only targets servers running on "localhost" To set the server this client is targeting, use `setPort(int)`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Client.Response` A response received from the server.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Client()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Client.Response` | `executionFunction(java.lang.Class<? extends java.util.function.Function<javax.servlet.http.HttpServletRequest,java.lang.String>> functionClass)` Instantiate and execute a function in the server.
    `Client.Response` | `get(java.lang.String key)` Get the value of a session attribute on the server
    `Client.Response` | `get(java.lang.String key, boolean storeRespCookie)` Get the value of a session attribute on the server
    `Client.Response` | `invalidate()` Invalidate this clients session on the server
    `Client.Response` | `invalidate(boolean storeRespCookie)` Invalidate this clients session on the server
    `Client.Response` | `remove(java.lang.String key)` Remove the session attribute on the server
    `Client.Response` | `remove(java.lang.String key, boolean storeRespCookie)` Remove the session attribute on the server
    `Client.Response` | `set(java.lang.String key, java.lang.String value)` Set the value of a session attribute on the server
    `Client.Response` | `set(java.lang.String key, java.lang.String value, boolean storeRespCookie)` Set the value of a session attribute on the server
    `Client.Response` | `setMaxInactive(int time)` Set the maximum inactive interval for this client's session on the server.
    `Client.Response` | `setMaxInactive(int time, boolean storeRespCookie)` Set the maximum inactive interval for this client's session on the server.
    `void` | `setPort(int port)` Change the server that the client is targeting.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Client

          public Client()

  - ### Method Detail

    - #### setPort

          public void setPort(int port)

      Change the server that the client is targeting.
      Parameters:
        `port` - the port that the server is listening on

    - #### get

          public Client.Response get(java.lang.String key)
                              throws java.io.IOException,
                                     java.net.URISyntaxException

      Get the value of a session attribute on the server
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### get

          public Client.Response get(java.lang.String key,
                                     boolean storeRespCookie)
                              throws java.io.IOException,
                                     java.net.URISyntaxException

      Get the value of a session attribute on the server
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### set

          public Client.Response set(java.lang.String key,
                                     java.lang.String value)
                              throws java.io.IOException,
                                     java.net.URISyntaxException

      Set the value of a session attribute on the server
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### set

          public Client.Response set(java.lang.String key,
                                     java.lang.String value,
                                     boolean storeRespCookie)
                              throws java.io.IOException,
                                     java.net.URISyntaxException

      Set the value of a session attribute on the server
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### executionFunction

          public Client.Response executionFunction(java.lang.Class<? extends java.util.function.Function<javax.servlet.http.HttpServletRequest,java.lang.String>> functionClass)
                                            throws java.io.IOException,
                                                   java.net.URISyntaxException

      Instantiate and execute a function in the server. Note that this function must be present in the sesssion testing war.
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### remove

          public Client.Response remove(java.lang.String key)
                                 throws java.io.IOException,
                                        java.net.URISyntaxException

      Remove the session attribute on the server
      Parameters:
        `key` - - the session attribute to remove
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### remove

          public Client.Response remove(java.lang.String key,
                                        boolean storeRespCookie)
                                 throws java.net.URISyntaxException,
                                        java.io.IOException

      Remove the session attribute on the server
      Parameters:
        `key` - - the session attribute to remove
        `storeRespCookie` - - whether or not to store the session cookie of this request
      Throws:
        `java.net.URISyntaxException`
        `java.io.IOException`

    - #### invalidate

          public Client.Response invalidate()
                                     throws java.io.IOException,
                                            java.net.URISyntaxException

      Invalidate this clients session on the server
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### invalidate

          public Client.Response invalidate(boolean storeRespCookie)
                                     throws java.io.IOException,
                                            java.net.URISyntaxException

      Invalidate this clients session on the server
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### setMaxInactive

          public Client.Response setMaxInactive(int time)
                                         throws java.io.IOException,
                                                java.net.URISyntaxException

      Set the maximum inactive interval for this client's session on the server. If this time interval elapses without activity on the session, the session will expire.
      Parameters:
        `time` - - Time in seconds until the session should expire
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`

    - #### setMaxInactive

          public Client.Response setMaxInactive(int time,
                                                boolean storeRespCookie)
                                         throws java.io.IOException,
                                                java.net.URISyntaxException

      Set the maximum inactive interval for this client's session on the server. If this time interval elapses without activity on the session, the session will expire.
      Parameters:
        `time` - - Time in seconds until the session should expire
      Throws:
        `java.io.IOException`
        `java.net.URISyntaxException`