void onStreamConnectSuccess() {
    boolean debugEnabled = LOG.isDebugEnabled();

    _curState = State.STREAM_REQUEST_WRITE;

    ChannelPipeline channelPipeline = _channel.getPipeline();
    _readTimeOutHandler =
        (ExtendedReadTimeoutHandler)
            channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
    _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

    StreamHttpResponseProcessor streamResponseProcessor =
        new StreamHttpResponseProcessor(this, _callback, _callbackStateReuse, _readTimeOutHandler);

    StringBuilder uriString = new StringBuilder(1024);

    boolean error = populateStreamRequestUrl(uriString);

    if (error) {
      return;
    }
    final String url = uriString.toString();

    if (debugEnabled) LOG.debug("Sending " + url);

    // Prepare the HTTP request.
    HttpRequest request = createEmptyRequest(url);
    sendRequest(request, new StreamRequestResultListener(), streamResponseProcessor);
  }
  void onRegisterConnectSuccess() {
    _curState = State.REGISTER_REQUEST_WRITE;

    ChannelPipeline channelPipeline = _channel.getPipeline();
    _readTimeOutHandler =
        (ExtendedReadTimeoutHandler)
            channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
    _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

    RegisterHttpResponseProcessor registerResponseProcessor =
        new RegisterHttpResponseProcessor(
            this, _callback, _callbackStateReuse, _readTimeOutHandler);

    final String url = createRegisterUrl();

    LOG.info("Sending " + url);

    // Prepare the HTTP request.
    HttpRequest request = createEmptyRequest(url);
    sendRequest(request, new RegisterRequestResultListener(), registerResponseProcessor);
  }
  void onSourcesConnectSuccess() {
    _curState = State.SOURCES_REQUEST_WRITE;

    ChannelPipeline channelPipeline = _channel.getPipeline();
    _readTimeOutHandler =
        (ExtendedReadTimeoutHandler)
            channelPipeline.get(GenericHttpClientPipelineFactory.READ_TIMEOUT_HANDLER_NAME);
    _readTimeOutHandler.start(channelPipeline.getContext(_readTimeOutHandler));

    SourcesHttpResponseProcessor<DatabusRelayConnectionStateMessage> sourcesResponseProcessor =
        new SourcesHttpResponseProcessor<DatabusRelayConnectionStateMessage>(
            this, _callback, _callbackStateReuse, _readTimeOutHandler);

    String uriString =
        "/sources?" + DatabusHttpHeaders.PROTOCOL_VERSION_PARAM + "=" + getProtocolVersion();

    LOG.info("Sending " + uriString);

    // Prepare the HTTP request.
    HttpRequest request = createEmptyRequest(uriString);
    sendRequest(request, new SourcesRequestResultListener(), sourcesResponseProcessor);
  }
 protected void stopReadTimeoutTimer() {
   if (null != _readTimeOutHandler) {
     _readTimeOutHandler.stop();
   }
 }