@Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    receivedMessages.mark();

    ChannelBuffer buffer = (ChannelBuffer) e.getMessage();

    byte[] readable = new byte[buffer.readableBytes()];
    buffer.toByteBuffer().get(readable, buffer.readerIndex(), buffer.readableBytes());

    GELFMessage msg = new GELFMessage(readable);

    switch (msg.getGELFType()) {
      case CHUNKED:
        dispatchedMessageChunk.mark();
        server.getGELFChunkManager().insert(msg);
        break;
      case ZLIB:
      case GZIP:
      case UNCOMPRESSED:
      case UNSUPPORTED:
        dispatchedUnchunkedMessage.mark();
        processor.messageReceived(msg);
        break;
    }
  }