java.lang.Object
io.helidon.webserver.testing.junit5.http2.Http2TestConnection
All Implemented Interfaces:
AutoCloseable

public class Http2TestConnection extends Object implements AutoCloseable
Http/2 low-level testing client connection.
  • Method Details

    • sendSettings

      public Http2TestConnection sendSettings(Http2Settings http2Settings)
      Send settings frame.
      Parameters:
      http2Settings - frame to send
      Returns:
      this connection
    • writer

      public Http2ConnectionWriter writer()
      Return connection writer for direct frame sending.
      Returns:
      connection writer
    • request

      public Http2TestConnection request(int streamId, Method method, String path, WritableHeaders<?> headers, BufferData payload)
      Send HTTP request with given stream id with single data frame created from supplied buffer data, dataframe has end of stream flag.
      Parameters:
      streamId - send request as given stream id
      method - http method
      path - context path
      headers - http headers
      payload - payload data which has to fit in single frame
      Returns:
      this connection
    • awaitNextFrame

      public Http2FrameData awaitNextFrame(Duration timeout)
      Await next frame, blocks until next frame arrive.
      Parameters:
      timeout - timeout for blocking
      Returns:
      next frame in order of reading from socket
    • assertRstStream

      public Http2RstStream assertRstStream(int streamId, Duration timeout)
      Wait for the next frame and assert its frame type to be RST_STREAM.
      Parameters:
      streamId - stream id asserted from retrieved RST_STREAM frame.
      timeout - timeout for blocking
      Returns:
      the frame
    • assertSettings

      public Http2Settings assertSettings(Duration timeout)
      Wait for the next frame and assert its frame type to be SETTINGS.
      Parameters:
      timeout - timeout for blocking
      Returns:
      the frame
    • assertWindowsUpdate

      public Http2WindowUpdate assertWindowsUpdate(int streamId, Duration timeout)
      Wait for the next frame and assert its frame type to be WINDOWS_UPDATE.
      Parameters:
      streamId - stream id asserted from retrieved WINDOWS_UPDATE frame.
      timeout - timeout for blocking
      Returns:
      the frame
    • assertHeaders

      public Http2Headers assertHeaders(int streamId, Duration timeout)
      Wait for the next frame and assert its frame type to be HEADERS.
      Parameters:
      streamId - stream id asserted from retrieved HEADERS frame.
      timeout - timeout for blocking
      Returns:
      the frame
    • assertNextFrame

      public Http2FrameData assertNextFrame(Http2FrameType frameType, Duration timeout)
      Wait for the next frame and assert its frame type.
      Parameters:
      frameType - expected type of frame
      timeout - timeout for blocking
      Returns:
      the frame
    • assertGoAway

      public Http2FrameData assertGoAway(Http2ErrorCode errorCode, String message, Duration timeout)
      Wait for the next frame and assert its frame type to be GO_AWAY.
      Parameters:
      errorCode - expected error code
      message - expected go away message
      timeout - timeout for blocking
      Returns:
      the frame
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • clientUri

      public ClientUri clientUri()
      Client uri used for connection, derived from Helidon test server.
      Returns:
      client uri