code: private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) {
          // length placeholder...
          int lengthStartIndex = buffer.writerIndex();
          buffer.writeByte(0);
  
          // reserved
          buffer.writeZero(1);
  
          // encode the path segments...
          int dataStartIndex = buffer.writerIndex();
  
          for (EPathSegment segment : path.getSegments()) {
              if (segment instanceof LogicalSegment) {
                  LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer);
              } else if (segment instanceof PortSegment) {
                  PortSegment.encode((PortSegment) segment, path.isPadded(), buffer);
              } else if (segment instanceof DataSegment) {
                  DataSegment.encode((DataSegment) segment, path.isPadded(), buffer);
              } else {
                  throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName());
              }
          }
  
          // go back and update the length
          int bytesWritten = buffer.writerIndex() - dataStartIndex;
          int wordsWritten = bytesWritten / 2;
          buffer.markWriterIndex();
          buffer.writerIndex(lengthStartIndex);
          buffer.writeByte(wordsWritten);
          buffer.resetWriterIndex();
      }
docs: Encode the connection path.
  <p>
  {@link PaddedEPath#encode(EPath, ByteBuf)} can't be used here because the {@link ForwardCloseRequest} has an
  extra reserved byte after the connection path size for some reason.
  
  @param path   the {@link PaddedEPath} to encode.
  @param buffer the {@link ByteBuf} to encode into.