This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
graphql-spring-boot-test/src/main/java/com/graphql/spring/boot/test Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1212import org .springframework .http .ResponseEntity ;
1313import org .springframework .lang .Nullable ;
1414import org .springframework .util .ResourceUtils ;
15+ import org .springframework .web .util .DefaultUriBuilderFactory ;
16+ import org .springframework .web .util .UriBuilderFactory ;
1517
1618import javax .websocket .ClientEndpointConfig ;
1719import javax .websocket .ContainerProvider ;
@@ -46,6 +48,7 @@ public class GraphQLTestSubscription {
4648
4749 private static final int SLEEP_INTERVAL_MS = 100 ;
4850 private static final AtomicInteger ID_COUNTER = new AtomicInteger (1 );
51+ private static final UriBuilderFactory URI_BUILDER_FACTORY = new DefaultUriBuilderFactory ();
4952
5053 @ Getter
5154 private Session session ;
@@ -339,7 +342,8 @@ public List<GraphQLResponse> getRemainingResponses() {
339342 private void initClient () throws Exception {
340343 final WebSocketContainer webSocketContainer = ContainerProvider .getWebSocketContainer ();
341344 final String port = environment .getProperty ("local.server.port" );
342- final URI uri = URI .create (String .format ("ws://localhost:%s/%s" , port , subscriptionPath ));
345+ final URI uri = URI_BUILDER_FACTORY .builder ().scheme ("ws" ).host ("localhost" ).port (port ).path (subscriptionPath )
346+ .build ();
343347 log .debug ("Connecting to client at {}" , uri );
344348 final ClientEndpointConfig clientEndpointConfig = ClientEndpointConfig .Builder .create ()
345349 .configurator (new TestWebSocketClientConfigurator ())
You can’t perform that action at this time.
0 commit comments