Search in sources :

Example 1 with Message

use of com.github.dedis.popstellar.model.network.method.Message in project popstellar by dedis.

the class ConnectionTest method sendMessageDelegatesToService.

@Test
public void sendMessageDelegatesToService() {
    LAOService service = mock(LAOService.class);
    BehaviorSubject<GenericMessage> messages = BehaviorSubject.create();
    when(service.observeMessage()).thenReturn(messages);
    BehaviorSubject<Lifecycle.State> manualState = BehaviorSubject.create();
    Connection connection = new Connection(service, manualState);
    Message msg = new Subscribe(Channel.ROOT, 12);
    connection.sendMessage(msg);
    verify(service).sendMessage(msg);
    verify(service).observeMessage();
    verifyNoMoreInteractions(service);
}
Also used : GenericMessage(com.github.dedis.popstellar.model.network.GenericMessage) Message(com.github.dedis.popstellar.model.network.method.Message) GenericMessage(com.github.dedis.popstellar.model.network.GenericMessage) Subscribe(com.github.dedis.popstellar.model.network.method.Subscribe) Test(org.junit.Test)

Aggregations

GenericMessage (com.github.dedis.popstellar.model.network.GenericMessage)1 Message (com.github.dedis.popstellar.model.network.method.Message)1 Subscribe (com.github.dedis.popstellar.model.network.method.Subscribe)1 Test (org.junit.Test)1