Skip to content

Commit

Permalink
Merge pull request quarkusio#42196 from mkouba/issue-42182
Browse files Browse the repository at this point in the history
WebSockets Next client: support string params for connector.baseUri()
  • Loading branch information
mkouba authored Jul 29, 2024
2 parents 99162f6 + eb18d0e commit b1de140
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class BasicConnectorTest {
@Test
void testClient() throws InterruptedException {

assertThrows(NullPointerException.class, () -> connector.baseUri(null));
assertThrows(IllegalArgumentException.class, () -> connector.baseUri("foo\\"));
assertThrows(NullPointerException.class, () -> connector.path(null));
assertThrows(NullPointerException.class, () -> connector.addHeader(null, "foo"));
assertThrows(NullPointerException.class, () -> connector.addHeader("foo", null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ClientAutoPingIntervalTest {

@Test
public void testPingPong() throws InterruptedException, ExecutionException {
connector.baseUri(uri).connectAndAwait();
connector.baseUri(uri.toString()).connectAndAwait();
// Ping messages are sent automatically
assertTrue(ClientEndpoint.PONG.await(5, TimeUnit.SECONDS));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ static BasicWebSocketConnector create() {
*/
BasicWebSocketConnector baseUri(URI uri);

/**
* Set the base URI.
*
* @param baseUri
* @return self
*/
default BasicWebSocketConnector baseUri(String baseUri) {
return baseUri(URI.create(baseUri));
}

/**
* Set the path that should be appended to the path of the URI set by {@link #baseUri(URI)}.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ public interface WebSocketConnector<CLIENT> {
*/
WebSocketConnector<CLIENT> baseUri(URI baseUri);

/**
* Set the base URI.
*
* @param baseUri
* @return self
*/
default WebSocketConnector<CLIENT> baseUri(String baseUri) {
return baseUri(URI.create(baseUri));
}

/**
* Set the path param.
* <p>
Expand Down

0 comments on commit b1de140

Please sign in to comment.