chia7712 commented on a change in pull request #9714: URL: https://github.com/apache/kafka/pull/9714#discussion_r539086381
########## File path: clients/src/main/java/org/apache/kafka/common/network/SizeDelimitedSend.java ########## @@ -14,18 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package org.apache.kafka.common.protocol; +package org.apache.kafka.common.network; import java.nio.ByteBuffer; -public final class MessageTestUtil { - public static ByteBuffer messageToByteBuffer(Message message, short version) { - ObjectSerializationCache cache = new ObjectSerializationCache(); - int size = message.size(cache, version); - ByteBuffer bytes = ByteBuffer.allocate(size); - message.write(new ByteBufferAccessor(bytes), cache, version); - bytes.rewind(); - return bytes; +/** + * A size delimited Send that consists of a 4 byte network-ordered size N followed by N bytes of content. + */ +public class SizeDelimitedSend extends ByteBufferSend { Review comment: > but it's an issue for many tests since they verify the properties of the ByteBuffer and it is not accessible if we do this. Can it be resolved if we return ```ByteBuffer``` rather than ```Send```? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org