In case anyone else finds this, the answer is ...
String command = "some command";
CommandSourceStack commandSourceStack = serverPlayer.createCommandSourceStack().withSuppressedOutput().withPermission(4);
CommandDispatcher<CommandSourceStack> commanddispatcher = serverPlayer.getServer().getCommands().getDispatcher();
ParseResults<CommandSourceStack> results = commanddispatcher.parse(command, commandSourceStack);
int result = serverPlayer.getServer().getCommands().performCommand(results, command);