code: protected void createDestination(ConnectionContext context, Endpoint endpoint) throws JMSException {
          if (endpoint == null) {
              throw new IllegalStateException("Endpoint is null");
          }
          if (context == null) {
              throw new IllegalStateException("The context is null");
          }
          Session session = context.getSession();
          if (session == null) {
              throw new IllegalStateException("The context had a null session");
          }
          Destination dest;
          if (endpoint.getType() == Endpoint.Type.QUEUE) {
              if (endpoint.isTemporary()) {
                  dest = session.createTemporaryQueue();
              } else {
                  dest = session.createQueue(getDestinationName(endpoint));
              }
          } else {
              if (endpoint.isTemporary()) {
                  dest = session.createTemporaryTopic();
              } else {
                  dest = session.createTopic(getDestinationName(endpoint));
              }
          }
          context.setDestination(dest);
      }
docs: Creates a destination using the context's session. The destination correlates to the given named queue or topic.
  
  @param context the context where the new destination is stored
  @param endpoint identifies the queue or topic
  @throws JMSException any error
  @throws IllegalStateException if the context is null or the context's session is null or endpoint is null