@Test public void checkWillUseDifferentClientIdsForEachConnection() throws Exception { setupMockBoundMessengerService(); DataObject msg = new DataObject(); createObservableSendDataAndSubscribe(msg); Bundle firstMessage = getReceivedBundle(0); String firstClientId = firstMessage.getString(KEY_CLIENT_ID); observableMessengerClient.closeConnection(); msg = new DataObject(); createObservableSendDataAndSubscribe(msg); Bundle secondMessage = getReceivedBundle(1); String secondClientId = secondMessage.getString(KEY_CLIENT_ID); assertThat(firstClientId).isNotEqualTo(secondClientId); }
public void closeConnection() { if (messengerConnection != null) { Log.d(TAG, "Closing connection with id: " + messengerConnection.getClientId()); try { context.unbindService(messengerConnection); } catch (Throwable t) { } messengerConnection = null; if (responseEmitter != null) { responseEmitter.onComplete(); responseEmitter = null; } } }
ObservableMessengerClient extends BaseChannelClient implements ChannelClient { public void closeConnection() { if (messengerConnection != null) { Log.d(TAG, "Closing connection with id: " + messengerConnection.getClientId()); try { context.unbindService(messengerConnection); } catch (Throwable t) { } messengerConnection = null; if (responseEmitter != null) { responseEmitter.onComplete(); responseEmitter = null; } } } }
ObservableMessengerClient extends BaseChannelClient implements ChannelClient { public void closeConnection() { if (messengerConnection != null) { Log.d(TAG, "Closing connection with id: " + messengerConnection.getClientId()); try { context.unbindService(messengerConnection); } catch (Throwable t) { } messengerConnection = null; if (responseEmitter != null) { responseEmitter.onComplete(); responseEmitter = null; } } } ObservableMessengerClient(Context context, ComponentName serviceComponentName);  ObservableMessengerClient(Context context, ComponentName serviceComponentName, OnHandleMessageCallback onHandleMessageCallback); }
ObservableMessengerClient extends BaseChannelClient implements ChannelClient { public void closeConnection() { if (messengerConnection != null) { Log.d(TAG, "Closing connection with id: " + messengerConnection.getClientId()); try { context.unbindService(messengerConnection); } catch (Throwable t) { } messengerConnection = null; if (responseEmitter != null) { responseEmitter.onComplete(); responseEmitter = null; } } } ObservableMessengerClient(Context context, ComponentName serviceComponentName);  ObservableMessengerClient(Context context, ComponentName serviceComponentName, OnHandleMessageCallback onHandleMessageCallback); boolean isConnected(); Completable connect(); Observable<String> sendMessage(final String requestData); void closeConnection(); }
ObservableMessengerClient extends BaseChannelClient implements ChannelClient { public void closeConnection() { if (messengerConnection != null) { Log.d(TAG, "Closing connection with id: " + messengerConnection.getClientId()); try { context.unbindService(messengerConnection); } catch (Throwable t) { } messengerConnection = null; if (responseEmitter != null) { responseEmitter.onComplete(); responseEmitter = null; } } } ObservableMessengerClient(Context context, ComponentName serviceComponentName);  ObservableMessengerClient(Context context, ComponentName serviceComponentName, OnHandleMessageCallback onHandleMessageCallback); boolean isConnected(); Completable connect(); Observable<String> sendMessage(final String requestData); void closeConnection();  }