java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.DestroySessionMessage
All Implemented Interfaces:
I2CPMessage

public class DestroySessionMessageextends I2CPMessageImpl
Defines the message a client sends to a router when destroying existing session.
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      I2CP message type code for a session teardown request.
      See Also:
    • _sessionId

      private SessionId _sessionId
      The session the client is closing.
  • Constructor Details

    • DestroySessionMessage

      public DestroySessionMessage()
      Creates an empty message, needed by I2CP deserialization.
  • Method Details

    • getSessionId

      public SessionId getSessionId()
      Session being closed.
      Returns:
      the session id, null until set or read
    • sessionId

      public SessionId sessionId()
      Return the SessionId for this message.
      Specified by:
      sessionId in interface I2CPMessage
      Overrides:
      sessionId in class I2CPMessageImpl
      Returns:
      null always. Extending classes with a SessionId must override.
    • setSessionId

      public void setSessionId(SessionId id)
      Session ID for this message.
      Parameters:
      id - the session to terminate, which this message will be sent on
    • doReadMessage

      protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException
      Read the message body from the input stream.
      Specified by:
      doReadMessage in class I2CPMessageImpl
      Parameters:
      in - positioned just past the 4 byte size and 1 byte type header
      size - how many payload bytes remain to be read
      Throws:
      I2CPMessageException - if the message format is invalid
      IOException - if there's an error reading from the stream
    • doWriteMessage

      protected byte[] doWriteMessage() throws I2CPMessageException, IOException
      Write the message body to the output stream.
      Specified by:
      doWriteMessage in class I2CPMessageImpl
      Returns:
      byte array
      Throws:
      I2CPMessageException - if the message cannot be written
      IOException - if there's an error writing to the stream
    • getType

      public int getType()
      Returns the I2CP message type code for this message.
      Returns:
      MESSAGE_TYPE, 3
    • toString

      public String toString()
      Returns a string representation of this message.
      Overrides:
      toString in class Object