protected void sendClientMessage(ClientMessage resultClientMessage) {
   resultClientMessage.setCorrelationId(clientMessage.getCorrelationId());
   resultClientMessage.addFlag(ClientMessage.BEGIN_AND_END_FLAGS);
   resultClientMessage.setVersion(ClientMessage.VERSION);
   final Connection connection = endpoint.getConnection();
   // TODO framing not implemented yet, should be split into frames before writing to connection
   connection.write(resultClientMessage);
 }
Ejemplo n.º 2
0
  @Test
  public void testUnsignedFields() throws IOException {
    ClientProtocolBuffer buffer = new SafeBuffer(new byte[18]);

    ClientMessage cmEncode = ClientMessage.createForEncode(buffer, 0);

    cmEncode.setVersion((short) (Byte.MAX_VALUE + 10));
    cmEncode.setMessageType(Short.MAX_VALUE + 10);
    cmEncode.setDataOffset((int) Short.MAX_VALUE + 10);
    cmEncode.setCorrelationId(Short.MAX_VALUE + 10);

    ClientMessage cmDecode = ClientMessage.createForDecode(buffer, 0);

    assertEquals(Byte.MAX_VALUE + 10, cmDecode.getVersion());
    assertEquals(Short.MAX_VALUE + 10, cmDecode.getMessageType());
    assertEquals((int) Short.MAX_VALUE + 10, cmDecode.getDataOffset());
  }