APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http.quic.frames

public final Class ConnectionCloseFrame

extends QuicFrame
Class Inheritance
Imports
jdk.internal.net.quic.QuicTransportException, .QuicTransportErrors, java.nio.BufferOverflowException, .ByteBuffer, java.nio.charset.StandardCharsets

A CONNECTION_CLOSE Frame
External Specification
https://www.rfc-editor.org/info/rfc9000

Field Summary

Modifier and TypeField and Description
public static final ConnectionCloseFrame
APPLICATION_ERROR

An immutable ConnectionCloseFrame of type 0x1c with no reason phrase and an error of type APPLICATION_ERROR.

private String
private String
public static final int
CONNECTION_CLOSE_VARIANT

This variant indicates an error originating from the higher level protocol, for instance, HTTP/3.

private final long
private final long
private final byte[]
private final boolean
Inherited from jdk.internal.net.http.quic.frames.QuicFrame:
ACKCONNECTION_CLOSECRYPTODATA_BLOCKEDHANDSHAKE_DONEMAX_DATAMAX_STREAM_DATAMAX_STREAMSMAX_VL_INTEGERNEW_CONNECTION_IDNEW_TOKENPADDINGPATH_CHALLENGEPATH_RESPONSEPINGRESET_STREAMRETIRE_CONNECTION_IDSTOP_SENDINGSTREAMSTREAM_DATA_BLOCKEDSTREAMS_BLOCKED

Constructor Summary

AccessConstructor and Description
pack-priv
ConnectionCloseFrame(ByteBuffer buffer, int type)

Incoming CONNECTION_CLOSE frame returned by QuicFrame.decode()

public
ConnectionCloseFrame(long errorCode, long errorFrameType, String reason)

Outgoing CONNECTION_CLOSE frame (variant with errorFrameType - 0x1c).

public
ConnectionCloseFrame(long errorCode, String reason)

Outgoing CONNECTION_CLOSE frame (variant without errorFrameType).

Method Summary

Modifier and TypeMethod and Description
public ConnectionCloseFrame

Returns:

a ConnectionCloseFrame suitable for inclusion in an Initial or Handshake packet
clearApplicationState
()

Returns a ConnectionCloseFrame suitable for inclusion in an Initial or Handshake packet.

public void
encode(ByteBuffer buffer)

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.encode.

Encode this QUIC Frame into given ByteBuffer

public long
public long
private static byte[]
public long
getTypeField()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.getTypeField.

Returns the type field that was / should be encoded.

public boolean
isAckEliciting()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.isAckEliciting.

Returns true if this frame is ACK-eliciting.

public boolean
public boolean
public byte[]
public String
public int
size()

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.size.

Returns the minimum number of bytes needed to encode this frame.

public String
toString()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.toString.

Returns a string representation of the object.

public boolean
Inherited from jdk.internal.net.http.quic.frames.QuicFrame:
decodedecodeVLFielddecodeVLFieldAsIntencodeVLFieldframeClassOfframeTypeframeTypeOfgetVLFieldLengthForisValidInputByteBufferrequireVLRangerequireVLRangevalidateRemainingLength

Field Detail

APPLICATION_ERRORback to summary
public static final ConnectionCloseFrame APPLICATION_ERROR

An immutable ConnectionCloseFrame of type 0x1c with no reason phrase and an error of type APPLICATION_ERROR.

API Note

From RFC 9000 - section 10.2.3:

A CONNECTION_CLOSE of type 0x1d MUST be replaced by a CONNECTION_CLOSE of type 0x1c when sending the frame in Initial or Handshake packets. Otherwise, information about the application state might be revealed. Endpoints MUST clear the value of the Reason Phrase field and SHOULD use the APPLICATION_ERROR code when converting to a CONNECTION_CLOSE of type 0x1c.
cachedReasonback to summary
private String cachedReason
cachedToStringback to summary
private String cachedToString
CONNECTION_CLOSE_VARIANTback to summary
public static final int CONNECTION_CLOSE_VARIANT

This variant indicates an error originating from the higher level protocol, for instance, HTTP/3.

errorCodeback to summary
private final long errorCode
errorFrameTypeback to summary
private final long errorFrameType
reasonback to summary
private final byte[] reason
variantback to summary
private final boolean variant

Constructor Detail

ConnectionCloseFrameback to summary
pack-priv ConnectionCloseFrame(ByteBuffer buffer, int type) throws QuicTransportException

Incoming CONNECTION_CLOSE frame returned by QuicFrame.decode()

Exceptions
QuicTransportException:
if the frame was malformed
ConnectionCloseFrameback to summary
public ConnectionCloseFrame(long errorCode, long errorFrameType, String reason)

Outgoing CONNECTION_CLOSE frame (variant with errorFrameType - 0x1c). This indicates a quic transport error.

ConnectionCloseFrameback to summary
public ConnectionCloseFrame(long errorCode, String reason)

Outgoing CONNECTION_CLOSE frame (variant without errorFrameType). This indicates an error originating from the higher level protocol, for instance HTTP/3.

Method Detail

clearApplicationStateback to summary
public ConnectionCloseFrame clearApplicationState()

Returns a ConnectionCloseFrame suitable for inclusion in an Initial or Handshake packet.

Returns:ConnectionCloseFrame

a ConnectionCloseFrame suitable for inclusion in an Initial or Handshake packet

encodeback to summary
public void encode(ByteBuffer buffer)

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.encode.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.encode.

Encode this QUIC Frame into given ByteBuffer

Annotations
@Override
errorCodeback to summary
public long errorCode()
errorFrameTypeback to summary
public long errorFrameType()
getReasonBytesback to summary
private static byte[] getReasonBytes(String reason)
getTypeFieldback to summary
public long getTypeField()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.getTypeField.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.getTypeField.

Returns the type field that was / should be encoded. This is the frame type with possibly some additional bits set, depending on the frame.

Annotations
@Override
isAckElicitingback to summary
public boolean isAckEliciting()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.isAckEliciting.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.isAckEliciting.

Returns true if this frame is ACK-eliciting. A frame is ACK-eliciting if it is anything other than QuicFrame#ACK, QuicFrame#PADDING or QuicFrame#CONNECTION_CLOSE (or its variant).

Annotations
@Override
isApplicationCodeback to summary
public boolean isApplicationCode()
isQuicTransportCodeback to summary
public boolean isQuicTransportCode()
reasonback to summary
public byte[] reason()
reasonStringback to summary
public String reasonString()
sizeback to summary
public int size()

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.size.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.size.

Returns the minimum number of bytes needed to encode this frame.

Annotations
@Override
toStringback to summary
public String toString()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
variantback to summary
public boolean variant()