imToken v2.14.1版本的 MD5 值为:83050b2c91219b46832c8336279e7878

以下内容为反编译后的 PrivateChannelExampleApp.java 源代码,内容仅作参考


package com.pusher.client.example;

import com.pusher.client.Pusher;
import com.pusher.client.PusherOptions;
import com.pusher.client.channel.PrivateChannel;
import com.pusher.client.channel.PrivateChannelEventListener;
import com.pusher.client.channel.PusherEvent;
import com.pusher.client.channel.SubscriptionEventListener;
import com.pusher.client.connection.ConnectionEventListener;
import com.pusher.client.connection.ConnectionState;
import com.pusher.client.connection.ConnectionStateChange;
import com.pusher.client.util.HttpAuthorizer;
public class PrivateChannelExampleApp {
    private String authorizationEndpoint = "http://localhost:3030/pusher/auth";
    private final PrivateChannel channel;
    private String channelName;
    private String channelsKey;
    private String cluster;
    private String eventName;

    public static void main(String[] strArr) {
        new PrivateChannelExampleApp(strArr);
    }

    PrivateChannelExampleApp(String[] strArr) {
        this.channelsKey = "FILL_ME_IN";
        this.channelName = "my-channel";
        this.eventName = "my-event";
        this.cluster = "eu";
        int length = strArr.length;
        if (length != 1) {
            if (length != 2) {
                if (length != 3) {
                    if (length == 4) {
                        this.cluster = strArr[3];
                    }
                    Pusher pusher = new Pusher(this.channelsKey, new PusherOptions().setUseTLS(true).setCluster(this.cluster).setAuthorizer(new HttpAuthorizer("http://localhost:3030/pusher/auth")));
                    pusher.connect(new ConnectionEventListener() {
                        @Override
                        public void onConnectionStateChange(ConnectionStateChange connectionStateChange) {
                            System.out.println(String.format("Connection state changed from [%s] to [%s]", connectionStateChange.getPreviousState(), connectionStateChange.getCurrentState()));
                        }

                        @Override
                        public void onError(String str, String str2, Exception exc) {
                            System.out.println(String.format("An error was received with message [%s], code [%s], exception [%s]", str, str2, exc));
                        }
                    }, new ConnectionState[0]);
                    this.channel = pusher.subscribePrivate(this.channelName, new PrivateChannelEventListener() {
                        @Override
                        public void onError(String str, Exception exc) {
                            SubscriptionEventListener.CC.$default$onError(this, str, exc);
                        }

                        @Override
                        public void onSubscriptionSucceeded(String str) {
                            System.out.println(String.format("Subscription to channel [%s] succeeded", str));
                        }

                        @Override
                        public void onEvent(PusherEvent pusherEvent) {
                            System.out.println(String.format("Received event [%s]", pusherEvent.toString()));
                        }

                        @Override
                        public void onAuthenticationFailure(String str, Exception exc) {
                            System.out.println(String.format("Authentication failure due to [%s], exception was [%s]", str, exc));
                        }
                    }, this.eventName);
                    while (true) {
                        try {
                            Thread.sleep(1000L);
                        } catch (InterruptedException e2) {
                            e2.printStackTrace();
                        }
                    }
                }
                this.eventName = strArr[2];
            }
            this.channelName = strArr[1];
        }
        this.channelsKey = strArr[0];
        Pusher pusher2 = new Pusher(this.channelsKey, new PusherOptions().setUseTLS(true).setCluster(this.cluster).setAuthorizer(new HttpAuthorizer("http://localhost:3030/pusher/auth")));
        pusher2.connect(new ConnectionEventListener() {
            @Override
            public void onConnectionStateChange(ConnectionStateChange connectionStateChange) {
                System.out.println(String.format("Connection state changed from [%s] to [%s]", connectionStateChange.getPreviousState(), connectionStateChange.getCurrentState()));
            }

            @Override
            public void onError(String str, String str2, Exception exc) {
                System.out.println(String.format("An error was received with message [%s], code [%s], exception [%s]", str, str2, exc));
            }
        }, new ConnectionState[0]);
        this.channel = pusher2.subscribePrivate(this.channelName, new PrivateChannelEventListener() {
            @Override
            public void onError(String str, Exception exc) {
                SubscriptionEventListener.CC.$default$onError(this, str, exc);
            }

            @Override
            public void onSubscriptionSucceeded(String str) {
                System.out.println(String.format("Subscription to channel [%s] succeeded", str));
            }

            @Override
            public void onEvent(PusherEvent pusherEvent) {
                System.out.println(String.format("Received event [%s]", pusherEvent.toString()));
            }

            @Override
            public void onAuthenticationFailure(String str, Exception exc) {
                System.out.println(String.format("Authentication failure due to [%s], exception was [%s]", str, exc));
            }
        }, this.eventName);
        while (true) {
            Thread.sleep(1000L);
        }
    }
}