private CitrusWebSocketHandler getWebSocketClientHandler ( String url ) { CitrusWebSocketHandler handler = new CitrusWebSocketHandler ( ) ; if ( webSocketHttpHeaders == null ) { webSocketHttpHeaders = new WebSocketHttpHeaders ( ) ; webSocketHttpHeaders . setSecWebSocketExtensions ( Collections . singletonList ( new StandardToWebSocketExtensionAdapter ( new JsrExtension ( new PerMessageDeflateExtension ( ) . getName ( ) ) ) ) ) ; } ListenableFuture < WebSocketSession > future = client . doHandshake ( handler , webSocketHttpHeaders , UriComponentsBuilder . fromUriString ( url ) . buildAndExpand ( ) . encode ( ) . toUri ( ) ) ; try { future . get ( ) ; } catch ( Exception e ) { String errMsg = String . format ( "Failed to connect to Web Socket server - '%s'" , url ) ; LOG . error ( errMsg ) ; throw new CitrusRuntimeException ( errMsg ) ; } return handler ; }
Creates new client web socket handler by opening a new socket connection to server .