Cannot cast RemoteWebDriver to AppiumDriver when run on Java 21

I am trying to connect to the device through Appium 9.0 and Selenium 4.14.1 on Java 21. I can create a connection to Appium success but I got a ClassCastException when cast from RemoteWebDrive to AppiumDriver for running command get context handlers after that

The code sample is below:

public static Object[] getContextHandles(RemoteWebDriver remote) {
try {
Response response = ((AppiumDriver)remote).execute(DriverCommand.GET_CONTEXT_HANDLES, ImmutableMap.of());
Object value = response.getValue();
@SuppressWarnings(“unchecked”)
List returnedValues = (List) value;
return returnedValues.toArray(new String[0]);
} catch (Throwable ex) {
Problems.handleException(“getContextHandles”, ex);
}
return null;
}

And the exception: java.lang.ClassCastException: class [B cannot be cast to class io.appium.java_client.AppiumDriver ([B is in module java.base of loader ‘bootstrap’; io.appium.java_client.AppiumDriver is in unnamed module of loader java.net.URLClassLoader @7a6bcd14)

Information:
OpenJDK version: 21 GA
Selenium: 4.14.1
Appium: 9.0

I would ask Is Appium Java Client already supports Java 21 or not. I can work correctly when try to downgrade OpenJDK 21 to OpenJDK 11 or 17.
Please support me to resolve the problem.