Search in sources :

Example 66 with ChannelBuffer

use of org.jboss.netty.buffer.ChannelBuffer in project canal by alibaba.

the class BinlogDumpCommandBuilder method toChannelBuffer.

public ChannelBuffer toChannelBuffer(BinlogDumpCommandPacket command) throws IOException {
    byte[] commandBytes = command.toBytes();
    byte[] headerBytes = assembleHeaderBytes(commandBytes.length);
    ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(headerBytes, commandBytes);
    return buffer;
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 67 with ChannelBuffer

use of org.jboss.netty.buffer.ChannelBuffer in project canal by alibaba.

the class ChannelBufferHelper method buildChannelBufferFromCommandPacket.

public final ChannelBuffer buildChannelBufferFromCommandPacket(IPacket packet) throws IOException {
    byte[] bodyBytes = packet.toBytes();
    ChannelBuffer header = createHeader(bodyBytes.length, (byte) 0);
    return ChannelBuffers.wrappedBuffer(header, ChannelBuffers.wrappedBuffer(bodyBytes));
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 68 with ChannelBuffer

use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.

the class ClientClosePacket method readBuffer.

public static ClientClosePacket readBuffer(short packetType, ChannelBuffer buffer) {
    assert packetType == PacketType.CONTROL_CLIENT_CLOSE;
    if (buffer.readableBytes() < 4) {
        buffer.resetReaderIndex();
        return null;
    }
    final ChannelBuffer payload = PayloadPacket.readPayload(buffer);
    if (payload == null) {
        return null;
    }
    final ClientClosePacket requestPacket = new ClientClosePacket();
    return requestPacket;
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 69 with ChannelBuffer

use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.

the class ClientClosePacket method toBuffer.

@Override
public ChannelBuffer toBuffer() {
    ChannelBuffer header = ChannelBuffers.buffer(2 + 4);
    header.writeShort(PacketType.CONTROL_CLIENT_CLOSE);
    return PayloadPacket.appendPayload(header, payload);
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 70 with ChannelBuffer

use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.

the class ControlHandshakePacket method toBuffer.

@Override
public ChannelBuffer toBuffer() {
    ChannelBuffer header = ChannelBuffers.buffer(2 + 4 + 4);
    header.writeShort(PacketType.CONTROL_HANDSHAKE);
    header.writeInt(getRequestId());
    return PayloadPacket.appendPayload(header, payload);
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Aggregations

ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)494 DefaultHttpResponse (org.jboss.netty.handler.codec.http.DefaultHttpResponse)70 Test (org.junit.Test)67 DeviceSession (org.traccar.DeviceSession)64 Position (org.traccar.model.Position)62 HttpResponse (org.jboss.netty.handler.codec.http.HttpResponse)61 Test (org.testng.annotations.Test)49 HttpChunk (org.jboss.netty.handler.codec.http.HttpChunk)48 DefaultHttpChunk (org.jboss.netty.handler.codec.http.DefaultHttpChunk)44 HttpChunkTrailer (org.jboss.netty.handler.codec.http.HttpChunkTrailer)37 DefaultHttpChunkTrailer (org.jboss.netty.handler.codec.http.DefaultHttpChunkTrailer)34 ChannelFuture (org.jboss.netty.channel.ChannelFuture)28 Checkpoint (com.linkedin.databus.core.Checkpoint)27 ByteBuffer (java.nio.ByteBuffer)27 RecoverablePduException (com.cloudhopper.smpp.type.RecoverablePduException)26 UnrecoverablePduException (com.cloudhopper.smpp.type.UnrecoverablePduException)26 DateBuilder (org.traccar.helper.DateBuilder)26 BootstrapDatabaseTooOldException (com.linkedin.databus2.core.container.request.BootstrapDatabaseTooOldException)25 IOException (java.io.IOException)23 ArrayList (java.util.ArrayList)23