Example usage for com.rabbitmq.client.impl Frame Frame

List of usage examples for com.rabbitmq.client.impl Frame Frame

Introduction

In this page you can find the example usage for com.rabbitmq.client.impl Frame Frame.

Prototype

public Frame(int type, int channel, byte[] payload) 

Source Link

Document

Constructs a frame for input with a type, a channel number and a payload byte array.

Usage

From source file:de.htwk_leipzig.bis.connection.handshake.clientRewrite.AMQCommand.java

License:Mozilla Public License

/**
 * Since we're using a pre-computed value for EMPTY_FRAME_SIZE we check this
 * is actually correct when run against the framing code in Frame.
 *///  www .j ava2 s. c o m
private static void checkEmptyFrameSize() {
    Frame f = new Frame(AMQP.FRAME_BODY, 0, new byte[0]);
    ByteArrayOutputStream s = new ByteArrayOutputStream();
    try {
        f.writeTo(new DataOutputStream(s));
    } catch (IOException ioe) {
        throw new AssertionError("IOException while checking EMPTY_FRAME_SIZE");
    }
    int actualLength = s.toByteArray().length;
    if (EMPTY_FRAME_SIZE != actualLength) {
        throw new AssertionError("Internal error: expected EMPTY_FRAME_SIZE(" + EMPTY_FRAME_SIZE
                + ") is not equal to computed value: " + actualLength);
    }
}