message: test: Add delay/retry to websocket tests
  Websocket tests commonly fail on CI because socket setup
  timing may be slower than connection timing, and there were
  no retries before this. Add retries and pauses between them.
diff: +// The tests in this file can fail on CI if there isn't a timed retry.
  +
  #[cfg(all(feature = "websockets", feature = "async-std-runtime"))]
  mod websocket_connector_tests {
  use buttplug::{
  client::ButtplugClient,
  connector::{
  - ButtplugRemoteClientConnector,
  - ButtplugRemoteServerConnector,
  - ButtplugWebsocketClientTransport,
  - ButtplugWebsocketServerTransport,
  + ButtplugRemoteClientConnector, ButtplugRemoteServerConnector,
  + ButtplugWebsocketClientTransport, ButtplugWebsocketServerTransport,
  ButtplugWebsocketServerTransportOptions,
  },
  core::messages::serializer::{ButtplugClientJSONSerializer, ButtplugServerJSONSerializer},
  server::ButtplugRemoteServer,
  util::async_manager,
  };
  + use futures_timer::Delay;
  use std::sync::Arc;
  + use std::time::Duration;
  #[test]
  fn test_client_ws_client_server_ws_server_insecure() {
  @@ -37,18 +39,27 @@ mod websocket_connector_tests {
  server_clone.start(connector).await.unwrap();
  })
  .unwrap();
  -
  + let mut connected = false;
  + for _ in 0..10 {
  let connector = ButtplugRemoteClientConnector::<
  ButtplugWebsocketClientTransport,
  ButtplugClientJSONSerializer,
  - >::new(ButtplugWebsocketClientTransport::new_insecure_connector(
  + >::new(
  + ButtplugWebsocketClientTransport::new_insecure_connector(
  "ws://127.0.0.1:12345",
  - ));
  + ),
  + );
  let (client, _) = ButtplugClient::connect("Example Client", connector)
  .await
  .unwrap();
  - assert!(client.connected());
  + if client.connected() {
  + connected = true;
  + break;
  + }
  + Delay::new(Duration::from_secs(1)).await;
  + }
  + assert!(connected);
  server.disconnect().await.unwrap();
  });
  }
  @@ -63,13 +74,17 @@ mod websocket_connector_tests {
  let connector = ButtplugRemoteServerConnector::<
  ButtplugWebsocketClientTransport,
  ButtplugServerJSONSerializer,
  - >::new(ButtplugWebsocketClientTransport::new_insecure_connector(
  + >::new(
  + ButtplugWebsocketClientTransport::new_insecure_connector(
  "ws://127.0.0.1:12347",
  - ));
  + ),
  + );
  server_clone.start(connector).await.unwrap();
  })
  .unwrap();
  + let mut connected = false;
  + for _ in 0..10 {
  let connector = ButtplugRemoteClientConnector::<
  ButtplugWebsocketServerTransport,
  ButtplugClientJSONSerializer,
  @@ -86,10 +101,14 @@ mod websocket_connector_tests {
  let (client, _) = ButtplugClient::connect("Example Client", connector)
  .await
  .unwrap();
  - assert!(client.connected());
  + if client.connected() {
  + connected = true;
  + break;
  + }
  + Delay::new(Duration::from_secs(1)).await;
  + }
  + assert!(connected);
  server.disconnect().await.unwrap();
  });
  }
  -
  - // fn test_client_ws_client_server_ws_both() {}
  }
  