/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, 65536); }
new WebSocketClientHandshakerFactory().newHandshaker( uri, WebSocketVersion.V13, null, false, customHeaders);
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake * @param maxFramePayloadLength * Maximum allowable frame payload length. Setting this value to your application's * requirement may reduce denial of service attacks using long data frames. */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
int maxFramePayloadLength, boolean handleCloseFrames, boolean performMasking, boolean allowMaskMismatch) { this(WebSocketClientHandshakerFactory.newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, performMasking, allowMaskMismatch), handleCloseFrames);
WebSocketClientHandler(InetSocketAddress serverAddress, String contextPath, WebSocketClient webSocketClient) throws URISyntaxException { this.handshaker = WebSocketClientHandshakerFactory.newHandshaker( new URI("ws://" + serverAddress.getHostName() + ":" + serverAddress.getPort() + cleanContextPath(contextPath) + "/_mockserver_callback_websocket"), WebSocketVersion.V13, null, false, new DefaultHttpHeaders(), Integer.MAX_VALUE ); this.webSocketClient = webSocketClient; }
handshaker = WebSocketClientHandshakerFactory.newHandshaker(wsuri, version, subProtocols, !extensionHandshakers.isEmpty(), nettyHeaders, maxWebSocketFrameSize,!options.isSendUnmaskedFrames(),false);
handler = new WebSocketClientHandler(WebSocketClientHandshakerFactory.newHandshaker(uri, WebSocketVersion.V13, null, true, httpHeaders), callback);
@Override public void configure(final ChannelPipeline pipeline) { final String scheme = connection.getUri().getScheme(); if (!"ws".equalsIgnoreCase(scheme) && !"wss".equalsIgnoreCase(scheme)) throw new IllegalStateException("Unsupported scheme (only ws: or wss: supported): " + scheme); if (!supportsSsl() && "wss".equalsIgnoreCase(scheme)) throw new IllegalStateException("To use wss scheme ensure that enableSsl is set to true in configuration"); final int maxContentLength = cluster.connectionPoolSettings().maxContentLength; handler = new WebSocketClientHandler( WebSocketClientHandshakerFactory.newHandshaker( connection.getUri(), WebSocketVersion.V13, null, false, EmptyHttpHeaders.INSTANCE, maxContentLength)); pipeline.addLast("http-codec", new HttpClientCodec()); pipeline.addLast("aggregator", new HttpObjectAggregator(maxContentLength)); pipeline.addLast("ws-handler", handler); pipeline.addLast("gremlin-encoder", webSocketGremlinRequestEncoder); pipeline.addLast("gremlin-decoder", webSocketGremlinResponseDecoder); }
final WebSocketClientHandler wsHandler = new WebSocketClientHandler( WebSocketClientHandshakerFactory.newHandshaker( uri, WebSocketVersion.V13, null, false, EmptyHttpHeaders.INSTANCE, 65536)); final MessageSerializer serializer = new GryoMessageSerializerV3d0();
handshaker = WebSocketClientHandshakerFactory.newHandshaker(wsuri, version, subProtocols, !extensionHandshakers.isEmpty(), nettyHeaders, maxWebSocketFrameSize,!options.isSendUnmaskedFrames(),false);
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, 65536); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, 65536); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, 65536); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, 65536); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake * @param maxFramePayloadLength * Maximum allowable frame payload length. Setting this value to your application's * requirement may reduce denial of service attacks using long data frames. */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake * @param maxFramePayloadLength * Maximum allowable frame payload length. Setting this value to your application's * requirement may reduce denial of service attacks using long data frames. */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake * @param maxFramePayloadLength * Maximum allowable frame payload length. Setting this value to your application's * requirement may reduce denial of service attacks using long data frames. */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
/** * Creates a new handshaker. * * @param webSocketURL * URL for web socket communications. e.g "ws://myhost.com/mypath". * Subsequent web socket frames will be sent to this URL. * @param version * Version of web socket specification to use to connect to the server * @param subprotocol * Sub protocol request sent to the server. Null if no sub-protocol support is required. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param customHeaders * Custom HTTP headers to send during the handshake * @param maxFramePayloadLength * Maximum allowable frame payload length. Setting this value to your application's * requirement may reduce denial of service attacks using long data frames. */ public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
int maxFramePayloadLength, boolean handleCloseFrames, boolean performMasking, boolean allowMaskMismatch) { this(WebSocketClientHandshakerFactory.newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, performMasking, allowMaskMismatch), handleCloseFrames);
int maxFramePayloadLength, boolean handleCloseFrames, boolean performMasking, boolean allowMaskMismatch) { this(WebSocketClientHandshakerFactory.newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, performMasking, allowMaskMismatch), handleCloseFrames);