@Test public void shouldReadNewMarketDataSimpleMessages() throws CommunicationException { when(client.tryReceiveByte()).thenReturn(MessageType.NEW_MARKET_DATA_SIMPLE.getMessageNumber()); when(client.tryReceiveLong()).thenReturn(1405782575L); when(client.tryReceiveDouble()).thenReturn(1.0, 2.0, 3.0, 4.0); final NewMarketDataSimpleMessage readMessage = cut.readMessage(NewMarketDataSimpleMessage.class); assertThat(readMessage.getCandleStick()) .isEqualTo(new DatedCandleStick<>(Instant.ofEpochSecond(1405782575L), 1.0, 2.0, 3.0, 4.0)); }
public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } MessageBasedClientConnection(final ClientConnection connection); }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } MessageBasedClientConnection(final ClientConnection connection); Message readMessage(); @SuppressWarnings("unchecked") M readMessage(final Class<M> messageClass); void sendMessage(final Message message); @Override String toString(); }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } MessageBasedClientConnection(final ClientConnection connection); Message readMessage(); @SuppressWarnings("unchecked") M readMessage(final Class<M> messageClass); void sendMessage(final Message message); @Override String toString();  }