@Test(expected = MessageReadException.class) public void shouldFailWhenTradingEnvironmentMessagesContainsUnknownForexPair() throws CommunicationException { when(client.tryReceiveByte()).thenReturn(MessageType.TRADING_ENVIRONMENT_INFORMATION.getMessageNumber()); when(client.tryReceiveString()).thenReturn("sample unknown forex pair"); when(client.tryReceiveInteger()).thenReturn(5); when(client.tryReceiveLong()).thenReturn(20L); cut.readMessage(TradingEnvironmentInformationMessage.class); }
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();  }