## 🐛 Bug Report

In Selenium Java Since EventFiringWebDriver got deprecated in Beta 2 I changed my implementation to envelop my remoteWebDriver into to a decorated Webdriver using EventFiringDecorator. But i am having trouble whenever i have to cast it as a JavascriptExecutor or back to a remotewebdriver to access some values. 

I get the following error:


```
java.lang.ClassCastException: class jdk.proxy2.$Proxy18 cannot be cast to class org.openqa.selenium.remote.RemoteWebDriver (jdk.proxy2.$Proxy18 is in module jdk.proxy2 of loader 'app'; org.openqa.selenium.remote.RemoteWebDriver is in unnamed module of loader 'app')
	at com.peektraffic.spinnaker.TestNgTestBase.initDriver(TestNgTestBase.java:570)
	at com.peektraffic.spinnaker.TestNgTestBase.init(TestNgTestBase.java:169)
	at com.peektraffic.spinnaker.Roles.Test_SystemPermissions.systemPermissions_AES_VERBA_INFO_Display(Test_SystemPermissions.java:1180)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
	at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:77)
	at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:15)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:831)
```

<!-- NOTE
FIREFOX 48+ IS ONLY COMPATIBLE WITH GECKODRIVER.

If the issue is with Google Chrome consider logging an issue with chromedriver instead:
https://chromedriver.chromium.org/help

If the issue is with Firefox GeckoDriver (aka Marionette) consider logging an issue with Mozilla:
https://bugzilla.mozilla.org/buglist.cgi?product=Testing&component=Marionette

If the issue is with Microsoft Edge consider logging an issue with Microsoft instead:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/

If the issue is with Safari, only Safari 10+ is supported. Please log any Safari issue with Apple:
https://bugreport.apple.com/

-->

## To Reproduce

<!--
Please be sure to include an SSCCE (Short, Self Contained, Correct [compilable] example) http://sscce.org/
If you can't provide a link to the page, consider creating a reproducible page on https://jsfiddle.net/
-->

1. Create a new remote webdriver
2. implement a listener
3. decorate the remotewebdriver with EventFiringDecorator
4. cast the decorated driver into a JavascriptExecutor  or RemoteWebDriver

 

## Expected behavior

object type is changed

## Test script or set of commands reproducing this issue

```
private void initDriver(DesiredCapabilities capabilities) throws Exception
	{
		HashMap<String, String> data = Testdata.get();
		// BasicConfigurator.configure();
		EventListener eventListener = new EventListener();

		RemoteWebDriver rem;
		Long start = System.currentTimeMillis();
		while (true)
		{
			if (System.currentTimeMillis() - start >= MAX_TRY_MS.get())
			{
				fail(threadId.get() + "Couldn't Start driver within " + MAX_TRY_MS.get() + " ms.");
			}
			try
			{
				log(Status.INFO, "Initializing EventFiringWebDriver..");

				rem = new RemoteWebDriver(new URL(data.get("REMOTE_HUB_LOCATION")), capabilities);

				break;
			}
			catch (Exception e)
			{
				Thread.sleep(5000);
				// log(Status.INFO, "Exception "+ e);
			}

		}
		System.out.println(((RemoteWebDriver)new EventFiringDecorator(eventListener).decorate(rem)).getSessionId());
	}
```


## Environment

OS: windows 10<!-- Windows 10? OSX? -->
Browser:  firefox<!-- Chrome? Safari?  -->
Browser version: 86.0<!-- e.g.: 70.0.3538.110 -->
Browser Driver version: GeckoDriver 0.29 <!-- e.g.: ChromeDriver 2.43, GeckoDriver 0.23 -->
Language Bindings version: java 4 beta 3<!-- e.g.: Java 3.141.0 --> 
Selenium Grid version (if applicable): java 4 beta 3<!-- e.g.: 3.141.59 --> 

return massage(parent, context, element, locator);
    } catch (NoSuchElementException e) {
      remotableBys.put(locator.getClass(), Mechanism.CONTEXT);
      throw e;
    }
  }
  @Override
  public List<WebElement> findElements(By locator) {
    Require.nonNull("Locator", locator);
    return findElements(this, this, locator);
  }
  public List<WebElement> findElements(RemoteWebDriver parent, SearchContext context, By locator) {
    Mechanism mechanism = remotableBys.get(locator.getClass());
    if (mechanism != null) {
      List<WebElement> elements = mechanism.findElements(parent, context, locator);
      elements.forEach(e -> massage(parent, context, e, locator));
      return elements;
    }
    
    if (locator instanceof By.Remotable) {
      try {
        List<WebElement> elements = Mechanism.REMOTE.findElements(parent, context, locator);
        remotableBys.put(locator.getClass(), Mechanism.REMOTE);
        elements.forEach(e -> massage(parent, context, e, locator));
        return elements;
      } catch (NoSuchElementException e) {
        remotableBys.put(locator.getClass(), Mechanism.REMOTE);
        throw e;
      } catch (InvalidArgumentException e) {