Ejemplo n.º 1
0
  public Session connect(AgentWebSocketClientController controller) throws Exception {
    if (webSocketClient == null || !webSocketClient.isRunning()) {
      if (webSocketClient != null) {
        webSocketClient.stop();
      }
      webSocketClient = builder.build();
      webSocketClient.start();
    }

    LOG.info("Connecting to websocket endpoint: " + urlService.getAgentRemoteWebSocketUrl());
    ClientUpgradeRequest request = new ClientUpgradeRequest();
    request.addExtensions("fragment;maxLength=" + getMessageBufferSize());
    return webSocketClient
        .connect(controller, new URI(urlService.getAgentRemoteWebSocketUrl()), request)
        .get();
  }