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);
 }
 private boolean writeToConnection(ClientConnection connection, ClientMessage clientMessage) {
   clientMessage.addFlag(ClientMessage.BEGIN_AND_END_FLAGS);
   return connection.write(clientMessage);
 }