class Framer {

  public synchronized void frame(final MessageData message, final ByteBuf output) {
    Preconditions.checkArgument(
        message.getSize() < LENGTH_MAX_MESSAGE_FRAME, "Message size in excess of maximum length.");
    // Compress message
    if (compressionEnabled) {
      // Extract data from message
      // Compress data
      final byte[] compressed = compressor.compress(message.getData().toArrayUnsafe());
      // Construct new, compressed message
      frameMessage(new RawMessage(message.getCode(), Bytes.wrap(compressed)), output);
    } else {
      frameMessage(message, output);
    }
  }

  public  Framer(final HandshakeSecrets secrets);

}