Interface Http2SettingsSpec.Builder

Enclosing class:
Http2SettingsSpec

public static interface Http2SettingsSpec.Builder
  • Method Details

    • build

      Build a new Http2SettingsSpec.
      Returns:
      a new Http2SettingsSpec
    • connectProtocolEnabled

      Http2SettingsSpec.Builder connectProtocolEnabled(boolean connectProtocolEnabled)
      Sets the SETTINGS_ENABLE_CONNECT_PROTOCOL value.
      Parameters:
      connectProtocolEnabled - the SETTINGS_ENABLE_CONNECT_PROTOCOL value
      Returns:
      this
      Since:
      1.2.5
    • headerTableSize

      Http2SettingsSpec.Builder headerTableSize(long headerTableSize)
      Sets the SETTINGS_HEADER_TABLE_SIZE value.
      Parameters:
      headerTableSize - the SETTINGS_HEADER_TABLE_SIZE value
      Returns:
      this
    • initialWindowSize

      Http2SettingsSpec.Builder initialWindowSize(int initialWindowSize)
      Sets the SETTINGS_INITIAL_WINDOW_SIZE value.
      Parameters:
      initialWindowSize - the SETTINGS_INITIAL_WINDOW_SIZE value
      Returns:
      this
    • maxConcurrentStreams

      Http2SettingsSpec.Builder maxConcurrentStreams(long maxConcurrentStreams)
      Sets the SETTINGS_MAX_CONCURRENT_STREAMS value.
      Parameters:
      maxConcurrentStreams - the SETTINGS_MAX_CONCURRENT_STREAMS value
      Returns:
      this
    • maxDecodedRstFramesPerWindow

      Http2SettingsSpec.Builder maxDecodedRstFramesPerWindow(int maxDecodedRstFramesPerWindow, int maxDecodedRstFramesSecondsPerWindow)
      Sets the maximum number RST frames that are allowed per window before the connection is closed. This allows to protect against the remote peer flooding us with such frames and so use up a lot of CPU. 0 for any of the parameters means no protection should be applied. For server, the default {code maxDecodedRstFramesPerWindow} is 200 and for the client it is 0. The default {code maxDecodedRstFramesSecondsPerWindow} is 30.
      Parameters:
      maxDecodedRstFramesPerWindow - the maximum number RST frames that are allowed per window
      maxDecodedRstFramesSecondsPerWindow - the maximum seconds per window
      Returns:
      this
      Since:
      1.2.11
    • maxEncodedRstFramesPerWindow

      Http2SettingsSpec.Builder maxEncodedRstFramesPerWindow(int maxEncodedRstFramesPerWindow, int maxEncodedRstFramesSecondsPerWindow)
      Sets the maximum number RST frames that are allowed per window before the connection is closed. This allows to protect against the remote peer that will trigger us to generate a flood of RST frames and so use up a lot of CPU. 0 for any of the parameters means no protection should be applied. For server, the default {code maxEncodedRstFramesPerWindow} is 200 and for the client it is 0. The default {code maxEncodedRstFramesSecondsPerWindow} is 30.
      Parameters:
      maxEncodedRstFramesPerWindow - the maximum number RST frames that are allowed per window
      maxEncodedRstFramesSecondsPerWindow - the maximum seconds per window
      Returns:
      this
      Since:
      1.2.11
    • maxFrameSize

      Http2SettingsSpec.Builder maxFrameSize(int maxFrameSize)
      Sets the SETTINGS_MAX_FRAME_SIZE value.
      Parameters:
      maxFrameSize - the SETTINGS_MAX_FRAME_SIZE value
      Returns:
      this
    • maxHeaderListSize

      Http2SettingsSpec.Builder maxHeaderListSize(long maxHeaderListSize)
      Sets the SETTINGS_MAX_HEADER_LIST_SIZE value.
      Parameters:
      maxHeaderListSize - the SETTINGS_MAX_HEADER_LIST_SIZE value
      Returns:
      this
    • maxStreams

      Http2SettingsSpec.Builder maxStreams(long maxStreams)
      The connection is marked for closing once the number of all-time streams reaches maxStreams.
      Returns:
      this
      Since:
      1.0.33
    • pingAckDropThreshold

      default Http2SettingsSpec.Builder pingAckDropThreshold(int pingAckDropThreshold)
      Sets the maximum number of PING frame transmission attempts before closing the connection.

      This method configures how many PING frames will be sent without receiving an ACK before considering the connection as unresponsive and closing it. Each PING waits for pingAckTimeout(Duration) before either receiving an ACK (which resets the health check) or timing out and sending the next PING.

      Example with pingAckDropThreshold=1:

      1. Connection becomes idle
      2. First PING frame is sent
      3. Wait up to pingAckTimeout for ACK
      4. If no ACK received, connection is closed (1 attempt limit reached)

      Example with pingAckDropThreshold=2:

      1. Connection becomes idle
      2. First PING frame is sent
      3. Wait up to pingAckTimeout for ACK
      4. If no ACK received, second PING frame is sent
      5. Wait up to pingAckTimeout for ACK
      6. If no ACK received, connection is closed (2 attempt limit reached)

      A lower threshold detects connection failures more quickly but may lead to premature disconnections if network latency is high. A higher threshold tolerates more packet loss or delays but increases the time to detect truly dead connections.

      The default pingAckDropThreshold is 1, meaning only one PING frame will be sent. If no ACK is received within pingAckTimeout, the connection closes immediately.

      Parameters:
      pingAckDropThreshold - the maximum number of PING transmission attempts without receiving ACK. Must be a positive integer (minimum 1). Default is 1.
      Returns:
      this
      Since:
      1.2.12
    • pingAckTimeout

      default Http2SettingsSpec.Builder pingAckTimeout(Duration pingAckTimeout)
      Sets the timeout for receiving an ACK response to HTTP/2 PING frames.

      This method configures how long to wait for a PING ACK response before either retrying or closing the connection (based on pingAckDropThreshold(int)). This timeout is used in conjunction with the idle timeout to detect unresponsive connections.

      When a connection becomes idle (no reads/writes for the configured idle timeout duration), a PING frame is sent to check if the peer is still responsive. If no ACK is received within the pingAckTimeout duration, another PING attempt may be made (depending on pingAckDropThreshold). If all attempts fail, the connection is closed.

      Important: This setting only takes effect when used together with:

      • For client: ConnectionProvider with maxIdleTime configured
      • For server: HttpServer with idleTimeout configured
      Without an idle timeout, PING frames will not be sent.

      The timeout should be chosen based on your network conditions and requirements:

      • Too short: May cause false positives and premature connection closures due to temporary delays
      • Too long: Delays detection of truly unresponsive connections
      Consider your expected network latency, load patterns, and tolerance for stale connections.

      Parameters:
      pingAckTimeout - the timeout duration to wait for a PING ACK response. Must be a positive value.
      Returns:
      this
      Since:
      1.2.12