|
35 | 35 | public class WebsocketConnection implements AutoCloseable { |
36 | 36 |
|
37 | 37 | private final String host; |
38 | | - final Consumer<Session> onOpenHandler; |
39 | | - final Consumer<String> onMessageHandler; |
40 | | - final Consumer<Session> onCloseHandler; |
41 | | - final Consumer<Throwable> onErrorHandler; |
42 | | - final String keycloakHost; |
43 | | - final String keycloakClient; |
44 | | - final String keycloakClientSecret; |
45 | | - final String keycloakUser; |
46 | | - final String keycloakPassword; |
| 38 | + private final Consumer<Session> onOpenHandler; |
| 39 | + private final Consumer<String> onMessageHandler; |
| 40 | + private final Consumer<Session> onCloseHandler; |
| 41 | + private final Consumer<Throwable> onErrorHandler; |
| 42 | + private final String keycloakHost; |
| 43 | + private final String keycloakClient; |
| 44 | + private final String keycloakClientSecret; |
| 45 | + private final String keycloakUser; |
| 46 | + private final String keycloakPassword; |
47 | 47 |
|
48 | 48 | private WebsocketEndpoints endpoints; |
49 | | - private JsonMapper jsonMapper = JsonMapper.create(); |
50 | 49 |
|
51 | | - final CompletableFuture<Session> sessionReady = new CompletableFuture<>(); |
| 50 | + @lombok.Builder.Default |
| 51 | + private CompletableFuture<Session> sessionReady = new CompletableFuture<>(); |
| 52 | + @lombok.Builder.Default |
| 53 | + private JsonMapper jsonMapper = JsonMapper.create(); |
52 | 54 |
|
53 | 55 | public Session awaitOpen(Duration timeoutInMillis) { |
54 | 56 | try { |
@@ -84,7 +86,7 @@ public void send(byte[] message) { |
84 | 86 | log.debug("Sent binary message of length: " + message.length); |
85 | 87 | } |
86 | 88 |
|
87 | | - public void <T> send(T message) { |
| 89 | + public <T> void send(T message) { |
88 | 90 | Session s = awaitOpen(Duration.ofMillis(5000L)); |
89 | 91 | try { |
90 | 92 | s.getBasicRemote().sendText(jsonMapper.toStringFrom(message)); |
|
0 commit comments