Class UnsupportedVersionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
io.github.mahmoudimus.quic.packet.PacketDecodeException
io.github.mahmoudimus.quic.packet.UnsupportedVersionException
- All Implemented Interfaces:
Serializable
A long header packet of a version this endpoint does not speak. A server answers it with a
Version Negotiation packet (
versionNegotiation(int...)) when the datagram is at least 1200
bytes (RFC 9000 section 6.1). The connection IDs follow the version-independent invariants (RFC
8999), so they may be up to 255 bytes long.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUnsupportedVersionException(int version, byte[] destinationId, byte[] sourceId) An unsupported version. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]The packet's Destination Connection ID.byte[]sourceId()The packet's Source Connection ID.intversion()The version number in the packet.byte[]versionNegotiation(int... supportedVersions) The Version Negotiation packet that answers this packet: the connection IDs swapped and the supported versions listed (RFC 9000 section 17.2.1).Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
UnsupportedVersionException
public UnsupportedVersionException(int version, byte[] destinationId, byte[] sourceId) An unsupported version.- Parameters:
version- the version number in the packetdestinationId- the packet's Destination Connection IDsourceId- the packet's Source Connection ID
-
-
Method Details
-
version
public int version()The version number in the packet.- Returns:
- the 32-bit version
-
destinationId
public byte[] destinationId()The packet's Destination Connection ID.- Returns:
- a copy of its 0 to 255 bytes
-
sourceId
public byte[] sourceId()The packet's Source Connection ID.- Returns:
- a copy of its 0 to 255 bytes
-
versionNegotiation
public byte[] versionNegotiation(int... supportedVersions) The Version Negotiation packet that answers this packet: the connection IDs swapped and the supported versions listed (RFC 9000 section 17.2.1).- Parameters:
supportedVersions- the version numbers to offer, often with a reserved one added- Returns:
- the packet bytes
-