code: public static <T> Flowable<T> toFlowable(EventPublisher<T> eventPublisher) {
          PublishProcessor<T> publishProcessor = PublishProcessor.create();
          FlowableProcessor<T> flowableProcessor = publishProcessor.toSerialized();
          eventPublisher.onEvent(flowableProcessor::onNext);
          return flowableProcessor;
      }
docs: Converts the EventPublisher into a Flowable.
  
  @param eventPublisher the event publisher
  @param <T> the type of the event
  @return the Flowable