title: Spring websocket stomp client how to capture the connection is lost？
body: <p>I use <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html" rel="nofollow">spring websocket</a> stomp client. Below is a code fragment：</p>
  
  <pre><code>List&lt;Transport&gt; transports = new ArrayList&lt;Transport&gt;(2);
  transports.add(new WebSocketTransport(new StandardWebSocketClient()));
  transports.add(new RestTemplateXhrTransport());
  
  WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
  headers.add("Cookie", client.getCookieString());
  
  SockJsClient sockJsClient = new SockJsClient(transports);
  
  WebSocketStompClient stompClient = new WebSocketStompClient(sockJsClient);
  stompClient.setMessageConverter(new StringMessageConverter());
  ListenableFuture&lt;StompSession&gt; future = 
     stompClient.connect(configuration.getApp().getWebsocketServerBase() + "/websocket/sa", headers, new MyWebSocketHandler());
  
  future.addCallback(new SuccessCallback&lt;StompSession&gt;() {
      public void onSuccess(StompSession stompSession) {
          System.out.println("on Success!");
      }
  }, new FailureCallback() {
      public void onFailure(Throwable throwable) {
          System.out.println("on Failure!");
      }
  });
  </code></pre>
  
  <p>It works, but when websocket server is closed, the client doesn't receive the message.</p>
  
  <p>How to listener server close event?</p>