code: @Override
      public void onOpen(Session session, EndpointConfig config) {
  
          if (onOpen != null) {
              try {
                  Object args[] = new Object[onOpen.getMethod().getParameterTypes().length];
                  MethodData methodData = onOpen.getMethodData();
                  //check if method has optional Session parameter
                  int sessionIndex = methodData.getSessionIndex();
                  if (sessionIndex >= 0) {
                      args[sessionIndex] = session;
                  }
                  int configIndex = methodData.getEndpointConfigIndex();
                  if (configIndex >= 0) {
                      args[configIndex] = config;
                  }
                  if (shouldProcessPath) {
                      try {
                          //substitute values for @PathParam variables for this method.
                          onOpen.processPathParameters(this, args);
                      } catch (DecodeException e) {
                          /*
                           * If onOpen itself is not successful, onError() should not be invoked as there is no session at this point.
                           */
                          return;
                      }
                  }
                  onOpen.getMethod().invoke(appInstance, args);
  
              } catch (IllegalAccessException e) {
                  // allow instrumented FFDC to be used here
              } catch (IllegalArgumentException e) {
                  // allow instrumented FFDC to be used here
              } catch (InvocationTargetException e) {
                  // allow instrumented FFDC to be used here
              }
          }
      }
docs: /*
  (non-Javadoc)
  
  @see javax.websocket.Endpoint#onOpen(javax.websocket.Session, javax.websocket.EndpointConfig)