Skip to content

PortForwardResult does not expose methods to close WebSocketStreamHandler nor expose is state #2423

@SanjayVas

Description

@SanjayVas

Describe the bug
PortForwardResult's underlying WebSocketStreamHandler will remain open unless the WebSocket is closed remotely. Furthermore, PortForwardResult's methods that return streams will throw an IllegalStateException if the handler is closed, but does not expose a way to check the handler state to avoid the exception.

This is related to #865 but more specific.

Client Version
16.0.0

Kubernetes Version
1.24.0

Java Version
Java 11

To Reproduce
Steps to reproduce the behavior:

  1. Call PortForward.forward
  2. Call getInputStream/getOutputStream on the result with try-with-resources pattern

Expected behavior

  1. There is a way to check the state to avoid an IllegalStateExeption, e.g. exposing WebSocketStreamHandler.state via PortForwardResult.
  2. There is a way to close the underlying WebSocketStreamHandle, e.g. having PortForwardResult implement AutoCloseable and closing the WebSocketStreamHandle on close.

Server (please complete the following information):

  • OS: Linux (Debian Bookworm)
  • Environment: KinD
  • Cloud: None

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions