  @Test
  public void testSubmitCommand() throws Throwable {

    RaftSessionConnection connection = mock(RaftSessionConnection.class);
    when(connection.command(any(CommandRequest.class)))
        .thenReturn(CompletableFuture.completedFuture(CommandResponse.builder()
            .withStatus(RaftResponse.Status.OK)
            .withIndex(10)
            .withResult("Hello world!".getBytes())
            .build()));

    RaftSessionState state = new RaftSessionState("test", SessionId.from(1), UUID.randomUUID().toString(), TestPrimitiveType.instance(), 1000);
    RaftSessionManager manager = mock(RaftSessionManager.class);
    ThreadContext threadContext = new TestContext();

    RaftSessionInvoker submitter = new RaftSessionInvoker(connection, mock(RaftSessionConnection.class), state, new RaftSessionSequencer(state), manager, threadContext);
    assertArrayEquals(submitter.invoke(operation(COMMAND, HeapBytes.EMPTY)).get(), "Hello world!".getBytes());
    assertEquals(1, state.getCommandRequest());
    assertEquals(1, state.getCommandResponse());
    assertEquals(10, state.getResponseIndex());
  }