Class GrizzlyClientSocket


  • public class GrizzlyClientSocket
    extends java.lang.Object
    Implementation of the WebSocket interface.
    Author:
    Stepan Kopriva (stepan.kopriva at oracle.com), Pavel Bucek (pavel.bucek at oracle.com)
    • Field Detail

      • PROXY_URI

        public static final java.lang.String PROXY_URI
        Deprecated.
        Client-side user property to set proxy URI.

        Value is expected to be String and represent proxy URI. Protocol part is currently ignored but must be present (URI(String) is used for parsing).

             client.getProperties().put(GrizzlyClientSocket.PROXY_URI, "http://my.proxy.com:80");
             client.connectToServer(...);
         
        See Also:
        EndpointConfig.getUserProperties(), Constant Field Values
      • PROXY_HEADERS

        public static final java.lang.String PROXY_HEADERS
        Deprecated.
        Client-side user property to set additional proxy headers.

        Value is expected to be Map<String, String> and represent raw http headers to be added to initial request which is sent to proxy. Key corresponds to header name, value is header value.

        Sample below demonstrates use of this feature to set preemptive basic proxy authentication:

             final HashMap<String, String> proxyHeaders = new HashMap<String, String>();
             proxyHeaders.put("Proxy-Authorization", "Basic " +
                 Base64.getEncoder().encodeToString("username:password".getBytes(Charset.forName("UTF-8"))));
        
             client.getProperties().put(GrizzlyClientSocket.PROXY_HEADERS, proxyHeaders);
             client.connectToServer(...);
         
        Please note that these headers will be used only when establishing proxy connection, for modifying WebSocket handshake headers, see ClientEndpointConfig.Configurator.beforeRequest(java.util.Map).
        See Also:
        EndpointConfig.getUserProperties(), Constant Field Values
    • Method Detail

      • connect

        public void connect()
                     throws DeploymentException,
                            java.io.IOException
        Performs connect to server endpoint.
        Throws:
        DeploymentException - when there the server endpoint cannot be reached.
        java.io.IOException - when transport fails to start.