Returns a READY transport that will be used to create new streams.

<p>Returns {@code null} if the state is not READY.  Will try to connect if state is IDLE.
772540
@Nullable
  ClientTransport obtainActiveTransport() {
    ClientTransport savedTransport = activeTransport;
    if (savedTransport != null) {
      return savedTransport;
    }
    try {
      synchronized (lock) {
        savedTransport = activeTransport;
        // Check again, since it could have changed before acquiring the lock
        if (savedTransport != null) {
          return savedTransport;
        }
        if (state.getState() == IDLE) {
          channelLogger.log(ChannelLogLevel.INFO, "CONNECTING as requested");
          gotoNonErrorState(CONNECTING);
          startNewTransport();
        }
      }
    } finally {
      syncContext.drain();
    }
    return null;
  }
78484
@Override
    public Packet getNextPacket() throws IOException {
        final Buffer payload = getPayload();
        if (payload == null || payload.isEmpty()) {
            return null;
        }

        if (sipFramer.accept(payload)) {
            return sipFramer.frame(this, payload);
        } else if (rtpFramer.accept(payload)) {
            // RTP is tricky to parse so if we return
            // null then it wasn't an RTP packet afterall
            // so fall through...
            final RtpPacket rtp = frameRtp(payload);
            if (rtp != null) {
                return rtp;
            }
        }

        return new UnknownApplicationPacketImpl(this, payload);
    }
1137767
public Optional<ServerPort> activePort() {
        final Server server = this.server;
        return server != null ? server.activePort() : Optional.empty();
    }
383629
public StreamState getStreamState()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getStreamState");
    StreamState returnState = _sourceStream.getStreamState();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getStreamState", returnState);
    return returnState;
  }
127730
private Object getConnection()
    {
        /*
         * Jedis connection = factory.getConnection();
         * 
         * // If resource is not null means a transaction in progress.
         * 
         * if (settings != null) { for (String key : settings.keySet()) {
         * connection.configSet(key, settings.get(key).toString()); } }
         * 
         * if (resource != null && resource.isActive()) { return
         * ((RedisTransaction) resource).bindResource(connection); } else {
         * return connection; } if (resource == null || (resource != null &&
         * !resource.isActive()))
         */
        // means either transaction resource is not bound or it is not active,
        // but connection has already by initialized
        if (isBoundTransaction() && this.connection != null)
        {
            return this.connection;
        }

        // if running within transaction boundary.
        if (resource != null && resource.isActive())
        {
            // no need to get a connection from pool, as nested MULTI is not yet
            // supported.
            if (((RedisTransaction) resource).isResourceBound())
            {
                return ((RedisTransaction) resource).getResource();
            }
            else
            {
                Jedis conn = getAndSetConnection();
                return ((RedisTransaction) resource).bindResource(conn);
            }

        }
        else
        {
            Jedis conn = getAndSetConnection();
            return conn;
        }
    }
364958
@Override
    public Request<CreateTransitGatewayRequest> getDryRunRequest() {
        Request<CreateTransitGatewayRequest> request = new CreateTransitGatewayRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
84081
public ClientSocket openSticky()
  {
    State state = _state;
    if (! state.isSessionEnabled()) {
      return null;
    }

    ClientSocket stream = openRecycle();

    if (stream != null)
      return stream;

    long now = CurrentTime.currentTime();

    if (isFailed(now)) {
      return null;
    }

    if (isBusy(now)) {
      return null;
    }

    return connect();
  }
384277
@Override
	public synchronized T get()
	{
		T val;

		synchronized(this)
		{
			if(valRef==null || (val = valRef.get())==null)
			{
				val = make();
				valRef = new WeakReference<T>(val);
			}
		}
		return val;
	}
167471
private void init() {
        cacheable = null;
        status = SC_OK;
        streamDelegate = new ServletResponseStreamDelegate(this) {
            protected OutputStream createOutputStream() throws IOException {
                // Test if this request is really cacheable, otherwise,
                // just write through to underlying response, and don't cache
                if (isCacheable()) {
                    return cacheResponse.getOutputStream();
                }
                else {
                    // TODO: We need to tell the cache about this, somehow...
                    writeHeaders(cacheResponse, (HttpServletResponse) getResponse());
                    return super.getOutputStream();
                }
            }
        };
    }
635113
public String getState()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getState");

    //The only valid states in the SourceStream are Uncommitted,
    //Value and Completed so all tick ranges will be in one of
    //these states
    TickRange range = getTickRange();
    
    long firstSendPending = RangeList.INFINITY;
    if(_stream instanceof SourceStream)
      firstSendPending = ((SourceStream)_stream).getFirstMsgOutsideWindow();
  
    //we're actually only interested in Uncommitted and Value
    //Uncommitted maps to COMMITTING
    //Value before the in-doubt cursor are PENDING_ACK
    //Value after the in-doubt cursor are PENDING_SEND
    State state = State.COMPLETE;
    if(range.type == TickRange.Uncommitted)
      state = State.COMMITTING;
    else if(range.type == TickRange.Value && _tick < firstSendPending)
      state = State.PENDING_ACKNOWLEDGEMENT;
    else if(range.type == TickRange.Value && _tick >= firstSendPending)
      state = State.PENDING_SEND;
      
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getState", state);

    return state.toString();
  }
239119
private StateConnection requestLoop()
    throws IOException
  {
    StateConnection state = _state;
    StateConnection tailState = state;
    //Thread thread = Thread.currentThread();

    //startThread(thread);

    try {
      while (! _port.isClosed()) {
        switch (state) {
        case IDLE:
          tailState = state;
          return tailState;

        case ACTIVE:
          ServiceRef.flushOutbox();
          state = dispatchRequest();
          break;

        case READ:
          ServiceRef.flushOutbox();
          state = processPoll();
          break;

        case POLL:
          System.out.println("POLL: " + this + " " + port().pollManager());
          ServiceRef.flushOutbox();
          tailState = state;
          return tailState;

        case CLOSE_READ_S:
          ServiceRef.flushOutboxAndExecuteLast();
          tailState = state;
          return tailState;

        case CLOSE_READ_A:
          state = closeRead();
          break;

        case CLOSE:
          _state = state;
          tailState = state;
          ServiceRef.flushOutboxAndExecuteLast();
          close();
          tailState = _state;
          return tailState;

        case FREE:
          tailState = state;
          ServiceRef.flushOutboxAndExecuteLast();
          System.out.println("FREE: " + this);
          return tailState;

          /*
        case TIMEOUT:
          ServiceRef.flushOutbox();
          //state = timeoutRequest();
          return null;
          break;
          */

          /*
        case DESTROY:
          ServiceRef.flushOutbox();
          destroy();
          tailState = state;
          return tailState;
          */

        default:
          System.out.println("UNKNOWN-STATE: " + state + " " + this);
          _state = tailState = StateConnection.DESTROY;
          ServiceRef.flushOutbox();
          destroy();
          throw new IllegalStateException(String.valueOf(state));
        }
      }
    } catch (ClientDisconnectException e) {
    //  state = NextState.DESTROY;

      _port.stats().addLifetimeClientDisconnectCount();

      if (log.isLoggable(Level.FINER)) {
        log.finer(dbgId() + e);
      }
    } catch (InterruptedIOException e) {
      if (log.isLoggable(Level.FINEST)) {
        log.log(Level.FINEST, dbgId() + e, e);
      }
    } catch (IOException e) {
      if (log.isLoggable(Level.FINE)) {
        log.log(Level.FINE, dbgId() + e, e);
      }
    } catch (OutOfMemoryError e) {
      String msg = "TcpSocketLink OutOfMemory";

      Shutdown.shutdownOutOfMemory(msg);
    } catch (Throwable e) {
      if (log.isLoggable(Level.FINE)) {
        log.log(Level.FINE, dbgId() + e, e);
      }
    } finally {
      _state = tailState;
      //thread.setContextClassLoader(_loader);

      //finishThread(tailState);

      //ServiceRef.flushOutboxAndExecuteLast();
    }

    return state;
  }
656169
public static WebSocket newWebSocketIfSupported()
  {
    if ( null == g_factory && GWT.isClient() && getSupportDetector().isSupported() )
    {
      register( getSupportDetector().newFactory() );
      return g_factory.newWebSocket();
    }
    return ( null != g_factory ) ? g_factory.newWebSocket() : null;
  }
415636
public ServletInputStream getInputStream()
    {
        if (_inputState!=0 && _inputState!=1)
            throw new IllegalStateException();
        if (_in==null)
            _in = new ServletIn((HttpInputStream)_httpRequest.getInputStream());  
        _inputState=1;
        _reader=null;
        return _in;
    }
1075677
public boolean waitForConnectionInit() {
        try {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "waitForConnectionInit: waiting for the H2 connection to complete initialization on " + streamId());
            }
            // the connection isn't initialized yet; wait on the init lock
            boolean rc = muxLink.initLock.await(Constants.H2C_UPGRADE_TIMEOUT, java.util.concurrent.TimeUnit.MILLISECONDS);
            if (rc) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "waitForConnectionInit: stop waiting, H2 connection initialized " + streamId());
                }
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "waitForConnectionInit: stop waiting, timed out waiting for client ");
                }
                muxLink.close(muxLink.initialVC, new ProtocolException("http/2 protocol initialization failed"));
            }
            return rc;
        } catch (InterruptedException e) {
            // server error handled in caller
            return false;
        }
    }
508442
public StreamState getStreamState()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getStreamState");  
    StreamState returnValue = aiStream.getStreamState();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getStreamState", returnValue);
    return returnValue;  
  }
1102280
boolean isReady() {
        final ContainerAddress[] ds = destinations.get();
        if (ds == null)
            return false;
        for (final ContainerAddress d : ds)
            if (d == null)
                return false;
        final boolean ret = ds.length != 0; // this method is only called in tests and this needs to be true there.

        if (ret && LOGGER.isDebugEnabled())
            LOGGER.debug("at {} to {} is Ready " + shorthand(ds), thisNodeId, clusterId);

        return ret;
    }
674055
public InputStream getData() {
    if (data != null) {
      return new ByteArrayInputStream(data);
    } else if (dataStream != null) {
      return dataStream;
    } else {
      throw new IllegalStateException("Either the byte[] or the stream mustn't be null at this point.");
    }
  }