File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
main/java/com/openfin/desktop/demo
test/java/com/openfin/desktop Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,15 @@ public void createChannelClient() {
119119 JSONObject payload = new JSONObject ();
120120 payload .put ("name" , "java example" );
121121 desktopConnection .getChannel (CHANNEL_NAME ).connectAsync (false , payload ).thenAccept (client -> {
122+ client .addChannelListener (new ChannelListener () {
123+ @ Override
124+ public void onChannelConnect (ConnectionEvent connectionEvent ) {
125+ }
126+ @ Override
127+ public void onChannelDisconnect (ConnectionEvent connectionEvent ) {
128+ logger .info ("channel disconnected {}" , connectionEvent .getChannelId ());
129+ }
130+ });
122131 client .register ("event" , new ChannelAction () {
123132 @ Override
124133 public JSONObject invoke (String action , Object payload , JSONObject senderIdentity ) {
Original file line number Diff line number Diff line change 1616import org .slf4j .LoggerFactory ;
1717
1818/**
19- * JUnit tests for com.openfin.desktop.InterApplicationBus class
20- *
21- * Test cases in this class need to have access to an OpenFin HTML5 app to
22- * verify sub/pub workflow. Sources for the app can be found in release
23- * directory: PubSubExample.html. It is hosted by OpenFin at
24- * https://cdn.openfin.co/examples/junit/PubSubExample.html
19+ * JUnit tests for OpenFin Channel API
2520 *
2621 * Created by wche on 1/27/16.
2722 *
@@ -321,16 +316,15 @@ public void onClientDisconnect(ChannelClientConnectEvent connectionEvent) {
321316 });
322317
323318 desktopConnection .getChannel (channelName ).connectAsync ().thenAccept (client -> {
324- client .addChannelListener (new ChannelListener () {
319+ client .disconnect (new AckListener () {
325320 @ Override
326- public void onChannelConnect (ConnectionEvent connectionEvent ) {
321+ public void onSuccess (Ack ack ) {
322+ latch .countDown ();
327323 }
328324 @ Override
329- public void onChannelDisconnect (ConnectionEvent connectionEvent ) {
330- latch .countDown ();
325+ public void onError (Ack ack ) {
331326 }
332327 });
333- client .disconnect (null );
334328 });
335329 });
336330 latch .await (10 , TimeUnit .SECONDS );
You can’t perform that action at this time.
0 commit comments