本文整理汇总了Java中com.pusher.client.connection.ConnectionEventListener类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionEventListener类的具体用法?Java ConnectionEventListener怎么用?Java ConnectionEventListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionEventListener类属于com.pusher.client.connection包,在下文中一共展示了ConnectionEventListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PusherClient
import com.pusher.client.connection.ConnectionEventListener; //导入依赖的package包/类
public PusherClient(String key) {
channels = new HashMap<>();
PusherOptions options = new PusherOptions();
pusher = new Pusher(key, options);
pusher.connect(new ConnectionEventListener() {
@Override
public void onConnectionStateChange(ConnectionStateChange change) {
log("State changed from " + change.getPreviousState() + " to " + change.getCurrentState());
}
@Override
public void onError(String message, String code, Exception e) {
log("Error: " + message + " (" + code + ")");
}
}, ConnectionState.ALL);
}
开发者ID:prog-fun,项目名称:exchange-apis,代码行数:20,代码来源:PusherClient.java
示例2: testInitializeNotificationService_Success
import com.pusher.client.connection.ConnectionEventListener; //导入依赖的package包/类
@Test
public void testInitializeNotificationService_Success() throws Exception {
PusherOptions mockPusherOptions = PowerMockito.mock(PusherOptions.class);
Pusher mockPusher = PowerMockito.mock(Pusher.class);
Channel mockChannel = Mockito.mock(Channel.class);
PowerMockito.whenNew(PusherOptions.class).withNoArguments().thenReturn(mockPusherOptions);
Mockito.when(mockPusherOptions.setCluster(Mockito.anyString())).thenReturn(mockPusherOptions);
Mockito.when(mockPusherOptions.setActivityTimeout(Mockito.anyLong())).thenReturn(mockPusherOptions);
PowerMockito.whenNew(Pusher.class).withArguments(Mockito.anyString(), Mockito.isA(PusherOptions.class)).thenReturn(mockPusher);
Mockito.doNothing().when(mockPusher).connect(Mockito.isA(ConnectionEventListener.class), Mockito.isA(ConnectionState.class));
Mockito.when(mockPusher.subscribe(Mockito.anyString())).thenReturn(mockChannel);
Mockito.doNothing().when(mockChannel).bind(Mockito.anyString(), Mockito.isA(SubscriptionEventListener.class));
boolean result = pusherNotificationService.initializeNotificationService(getPlatformAuthDetailsResponseVO);
assertThat(result).isTrue();
PowerMockito.verifyNew(PusherOptions.class).withNoArguments();
Mockito.verify(mockPusherOptions, Mockito.times(1)).setCluster(Mockito.anyString());
Mockito.verify(mockPusherOptions, Mockito.times(1)).setActivityTimeout(Mockito.anyLong());
PowerMockito.verifyNew(Pusher.class).withArguments(Mockito.anyString(), Mockito.isA(PusherOptions.class));
Mockito.verify(mockPusher).connect(Mockito.isA(ConnectionEventListener.class), Mockito.isA(ConnectionState.class));
Mockito.verify(mockPusher, Mockito.times(1)).subscribe(Mockito.anyString());
Mockito.verify(mockChannel, Mockito.atLeastOnce()).bind(Mockito.anyString(), Mockito.isA(SubscriptionEventListener.class));
}
开发者ID:enjin,项目名称:Enjin-Coin-Java-SDK,代码行数:26,代码来源:PusherNotificationServiceTest.java
示例3: connect
import com.pusher.client.connection.ConnectionEventListener; //导入依赖的package包/类
@Override
public void connect(ConnectionEventListener eventListener, ConnectionState... connectionStates) {
this.pusher.connect(eventListener, connectionStates);
}
开发者ID:pusher,项目名称:pusher-websocket-android,代码行数:5,代码来源:PusherAndroid.java
注:本文中的com.pusher.client.connection.ConnectionEventListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论