Search in sources :

Example 1 with MessageProducer

use of io.grpc.internal.StreamListener.MessageProducer in project grpc-java by grpc.

the class RetriableStreamTest method messageAvailable.

@Test
public void messageAvailable() {
    ClientStream mockStream1 = mock(ClientStream.class);
    doReturn(mockStream1).when(retriableStreamRecorder).newSubstream(0);
    retriableStream.start(masterListener);
    ArgumentCaptor<ClientStreamListener> sublistenerCaptor1 = ArgumentCaptor.forClass(ClientStreamListener.class);
    verify(mockStream1).start(sublistenerCaptor1.capture());
    ClientStreamListener listener = sublistenerCaptor1.getValue();
    listener.headersRead(new Metadata());
    MessageProducer messageProducer = mock(MessageProducer.class);
    listener.messagesAvailable(messageProducer);
    verify(masterListener).messagesAvailable(messageProducer);
}
Also used : Metadata(io.grpc.Metadata) MessageProducer(io.grpc.internal.StreamListener.MessageProducer) Test(org.junit.Test)

Example 2 with MessageProducer

use of io.grpc.internal.StreamListener.MessageProducer in project grpc-java by grpc.

the class ForwardingClientStreamListenerTest method messagesAvailableTest.

@Test
public void messagesAvailableTest() {
    MessageProducer producer = mock(MessageProducer.class);
    forward.messagesAvailable(producer);
    verify(mock).messagesAvailable(same(producer));
}
Also used : MessageProducer(io.grpc.internal.StreamListener.MessageProducer) Test(org.junit.Test)

Aggregations

MessageProducer (io.grpc.internal.StreamListener.MessageProducer)2 Test (org.junit.Test)2 Metadata (io.grpc.Metadata)1