Class Handshake


  • public final class Handshake
    extends java.lang.Object
    Class responsible for performing and validating handshake.
    Author:
    Justin Lee, Pavel Bucek
    • Method Detail

      • createClientHandshake

        public static Handshake createClientHandshake​(RequestContext webSocketRequest)
        Client-side handshake.
        Parameters:
        webSocketRequest - request representation to be modified for use as WebSocket handshake request.
        Returns:
        handshake instance.
      • setSubProtocols

        public void setSubProtocols​(java.util.List<java.lang.String> subProtocols)
        Client side only - set the list of supported subprotocols.
        Parameters:
        subProtocols - list of supported subprotocol.
      • setExtensions

        public void setExtensions​(java.util.List<Extension> extensions)
        Client side only - set the list of supported extensions.
        Parameters:
        extensions - list of supported extensions.
      • validateServerResponse

        public void validateServerResponse​(UpgradeResponse response)
                                    throws HandshakeException
        Client side only - validate server response.
        Parameters:
        response - response to be validated.
        Throws:
        HandshakeException - when HTTP Status of received response is not 101 - Switching protocols.
      • updateHostAndOrigin

        public static void updateHostAndOrigin​(UpgradeRequest upgradeRequest)
        Client side only - Generate host and origin header and put them to the upgrade request headers.
        Parameters:
        upgradeRequest - upgrade request to be updated.