private Object createTyrusEndpoint(
      Endpoint endpoint,
      String endpointPath,
      String protocol,
      List<Extension> extensions,
      WebSocketContainer container,
      TyrusWebSocketEngine engine)
      throws DeploymentException {

    ServerEndpointRegistration endpointConfig =
        new ServerEndpointRegistration(endpointPath, endpoint);
    endpointConfig.setSubprotocols(Collections.singletonList(protocol));
    endpointConfig.setExtensions(extensions);
    return getEndpointHelper()
        .createdEndpoint(endpointConfig, this.componentProvider, container, engine);
  }
    @Override
    public Object createdEndpoint(
        ServerEndpointRegistration registration,
        ComponentProviderService provider,
        WebSocketContainer container,
        TyrusWebSocketEngine engine)
        throws DeploymentException {

      TyrusEndpointWrapper endpointWrapper =
          new TyrusEndpointWrapper(
              registration.getEndpoint(),
              registration,
              provider,
              container,
              "/",
              registration.getConfigurator());

      return new TyrusEndpoint(endpointWrapper);
    }
    @Override
    public Object createdEndpoint(
        ServerEndpointRegistration registration,
        ComponentProviderService provider,
        WebSocketContainer container,
        TyrusWebSocketEngine engine)
        throws DeploymentException {

      DirectFieldAccessor accessor = new DirectFieldAccessor(engine);
      Object sessionListener = accessor.getPropertyValue("sessionListener");
      Object clusterContext = accessor.getPropertyValue("clusterContext");
      try {
        if (constructorWithBooleanArgument) {
          // Tyrus 1.11+
          return constructor.newInstance(
              registration.getEndpoint(),
              registration,
              provider,
              container,
              "/",
              registration.getConfigurator(),
              sessionListener,
              clusterContext,
              null,
              Boolean.TRUE);
        } else {
          return constructor.newInstance(
              registration.getEndpoint(),
              registration,
              provider,
              container,
              "/",
              registration.getConfigurator(),
              sessionListener,
              clusterContext,
              null);
        }
      } catch (Exception ex) {
        throw new HandshakeFailureException("Failed to register " + registration, ex);
      }
    }