code: public void invokeEndpointMethod(final Executor executor, final Runnable invocation) {
          if (dispatchToWorker) {
              executor.execute(new Runnable() {
                  @Override
                  public void run() {
                      invokeEndpointMethod(invocation);
                  }
              });
          } else {
              invokeEndpointMethod(invocation);
          }
      }
docs: Runs a web socket invocation, setting up the threads and dispatching a thread pool
  <p>
  Unfortunately we need to dispatch to a thread pool, because there is a good chance that the endpoint
  will use blocking IO methods. We suspend recieves while this is in progress, to make sure that we do not have multiple
  methods invoked at once.
  <p>
  
  @param invocation The task to run