All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockserver.codec.NettyBinaryToMockServerBinaryResponseDecoder Maven / Gradle / Ivy

There is a newer version: 5.15.0
Show newest version
package org.mockserver.codec;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

import static org.mockserver.model.BinaryMessage.bytes;

public class NettyBinaryToMockServerBinaryResponseDecoder extends MessageToMessageDecoder {
    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List out) {
        out.add(bytes(ByteBufUtil.getBytes(byteBuf)));
    }
}