Search in sources :

Example 76 with ChannelBuffer

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

the class ResponsePacket method readBuffer.

public static ResponsePacket readBuffer(short packetType, ChannelBuffer buffer) {
    assert packetType == PacketType.APPLICATION_RESPONSE;
    if (buffer.readableBytes() < 8) {
        buffer.resetReaderIndex();
        return null;
    }
    final int messageId = buffer.readInt();
    ChannelBuffer payload = PayloadPacket.readPayload(buffer);
    if (payload == null) {
        return null;
    }
    ResponsePacket responsePacket = new ResponsePacket(payload.array());
    responsePacket.setRequestId(messageId);
    return responsePacket;
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 77 with ChannelBuffer

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

the class SendPacket method toBuffer.

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

Example 78 with ChannelBuffer

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

the class ServerClosePacket method readBuffer.

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

Example 79 with ChannelBuffer

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

the class StreamCreateFailPacket method toBuffer.

@Override
public ChannelBuffer toBuffer() {
    ChannelBuffer header = ChannelBuffers.buffer(2 + 4 + 2);
    header.writeShort(getPacketType());
    header.writeInt(getStreamChannelId());
    header.writeShort(code.value());
    return header;
}
Also used : ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 80 with ChannelBuffer

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

the class StreamCreatePacket method readBuffer.

public static StreamCreatePacket readBuffer(short packetType, ChannelBuffer buffer) {
    assert packetType == PACKET_TYPE;
    if (buffer.readableBytes() < 8) {
        buffer.resetReaderIndex();
        return null;
    }
    final int streamChannelId = buffer.readInt();
    final ChannelBuffer payload = PayloadPacket.readPayload(buffer);
    if (payload == null) {
        return null;
    }
    final StreamCreatePacket packet = new StreamCreatePacket(streamChannelId, payload.array());
    return packet;
}
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