-- tests improvement

This commit is contained in:
jacek.wolniewicz
2024-07-05 13:21:59 +02:00
parent e40bde8e7c
commit aa56f8eaea
8 changed files with 165 additions and 114 deletions

View File

@@ -78,17 +78,6 @@ public class TikTokLiveClient implements LiveClient
this.logger = logger;
}
public void connectAsync(Consumer<LiveClient> onConnection) {
connectAsync().thenAccept(onConnection);
}
public CompletableFuture<LiveClient> connectAsync() {
return CompletableFuture.supplyAsync(() -> {
connect();
return this;
});
}
public void connect() {
try {
tryConnect();
@@ -199,4 +188,15 @@ public class TikTokLiveClient implements LiveClient
messageHandler.handleSingleMessage(this, message);
}
public void connectAsync(Consumer<LiveClient> onConnection) {
connectAsync().thenAccept(onConnection);
}
public CompletableFuture<LiveClient> connectAsync() {
return CompletableFuture.supplyAsync(() -> {
connect();
return this;
});
}
}