src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte BOOLEAN = 0x0A;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte OBJECT_NAME = 0x06;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_ATTRIBUTES = 0x09;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte QUERY_EXP = 0x07;
src/main/java/org/jboss/remotingjmx/ServerMessageInterceptor.java
public interface Event {
    void run() throws IOException;
}
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte ADD_NOTIFICATION_LISTENER = 0x11;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte SET_OBJECT_INSTANCE = 0x0D;
src/main/java/org/jboss/remotingjmx/VersionedProxy.java
public interface VersionedProxy {

    String getConnectionId();

    void close();

}
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte NOTIFICATION_FILTER = 0x10;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_MBEAN_INFO = 0x0F;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte EXCEPTION = 0x03;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte FAILURE = 0x01;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte CREATE_MBEAN = 0x01;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte UNREGISTER_MBEAN = 0x02;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte QUERY_MBEANS = 0x04;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte OBJECT_INSTANCE = 0x0C;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte NOTIFICATION = 0x11;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte STRING_ARRAY = 0x09;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte SET_ATTRIBUTE = 0x0A;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_DOMAINS = 0x0E;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte SEND_NOTIFICATION = 0x13;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_DEFAULT_DOMAIN = 0x0D;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte MBEAN_INFO = 0x0E;
src/main/java/org/jboss/remotingjmx/ServerMessageInterceptor.java
public interface ServerMessageInterceptor {

    /**
     * Called to handle the actual event, gives the Interceptor an opportunity to wrap the call.
     *
     * @param event - The event to run.
     * @throws IOException - If thrown from the event.
     */
    void handleEvent(final Event event) throws IOException;

    public interface Event {
        void run() throws IOException;
    }

}
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte SET_OBJECT_NAME = 0x0F;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte RESPONSE_MASK = (byte) 0x80;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte ATTRIBUTE = 0x01;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte INTEGER_ARRAY = 0x12;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte OBJECT = 0x04;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte SUCCESS = 0x00;
src/main/java/org/jboss/remotingjmx/WrappedMBeanServerConnection.java
public interface WrappedMBeanServerConnection {

    MBeanServerConnection getMBeanServerConnection();

    void connectionOpened(final VersionedProxy proxy);

    void connectionClosed(final VersionedProxy proxy);

}
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte INSTANCE_OF = 0x10;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte IS_REGISTERED = 0x06;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte QUERY_NAMES = 0x05;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte SET_ATTRIBUTES = 0x0B;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte OBJECT_ARRAY = 0x05;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_ATTRIBUTE = 0x08;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte STRING = 0x08;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte INVOKE = 0x0C;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_MBEAN_COUNT = 0x07;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte GET_OBJECT_INSTANCE = 0x03;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte INTEGER = 0x0B;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte ATTRIBUTE_LIST = 0x02;
src/main/java/org/jboss/remotingjmx/protocol/v1/Constants.java
static final byte REMOVE_NOTIFICATION_LISTENER = 0x12;


Question: import static org.jboss.remotingjmx.protocol.v1.Constants.ADD_NOTIFICATION_LISTENER;
import static org.jboss.remotingjmx.protocol.v1.Constants.ATTRIBUTE;
import static org.jboss.remotingjmx.protocol.v1.Constants.ATTRIBUTE_LIST;
import static org.jboss.remotingjmx.protocol.v1.Constants.BOOLEAN;
import static org.jboss.remotingjmx.protocol.v1.Constants.CREATE_MBEAN;
import static org.jboss.remotingjmx.protocol.v1.Constants.EXCEPTION;
import static org.jboss.remotingjmx.protocol.v1.Constants.FAILURE;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_ATTRIBUTE;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_ATTRIBUTES;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_DEFAULT_DOMAIN;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_DOMAINS;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_MBEAN_COUNT;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_MBEAN_INFO;
import static org.jboss.remotingjmx.protocol.v1.Constants.GET_OBJECT_INSTANCE;
import static org.jboss.remotingjmx.protocol.v1.Constants.INSTANCE_OF;
import static org.jboss.remotingjmx.protocol.v1.Constants.INTEGER;
import static org.jboss.remotingjmx.protocol.v1.Constants.INTEGER_ARRAY;
import static org.jboss.remotingjmx.protocol.v1.Constants.INVOKE;
import static org.jboss.remotingjmx.protocol.v1.Constants.IS_REGISTERED;
import static org.jboss.remotingjmx.protocol.v1.Constants.MBEAN_INFO;
import static org.jboss.remotingjmx.protocol.v1.Constants.NOTIFICATION;
import static org.jboss.remotingjmx.protocol.v1.Constants.NOTIFICATION_FILTER;
import static org.jboss.remotingjmx.protocol.v1.Constants.OBJECT;
import static org.jboss.remotingjmx.protocol.v1.Constants.OBJECT_ARRAY;
import static org.jboss.remotingjmx.protocol.v1.Constants.OBJECT_INSTANCE;
import static org.jboss.remotingjmx.protocol.v1.Constants.OBJECT_NAME;
import static org.jboss.remotingjmx.protocol.v1.Constants.QUERY_EXP;
import static org.jboss.remotingjmx.protocol.v1.Constants.QUERY_MBEANS;
import static org.jboss.remotingjmx.protocol.v1.Constants.QUERY_NAMES;
import static org.jboss.remotingjmx.protocol.v1.Constants.REMOVE_NOTIFICATION_LISTENER;
import static org.jboss.remotingjmx.protocol.v1.Constants.RESPONSE_MASK;
import static org.jboss.remotingjmx.protocol.v1.Constants.SEND_NOTIFICATION;
import static org.jboss.remotingjmx.protocol.v1.Constants.SET_ATTRIBUTE;
import static org.jboss.remotingjmx.protocol.v1.Constants.SET_ATTRIBUTES;
import static org.jboss.remotingjmx.protocol.v1.Constants.SET_OBJECT_INSTANCE;
import static org.jboss.remotingjmx.protocol.v1.Constants.SET_OBJECT_NAME;
import static org.jboss.remotingjmx.protocol.v1.Constants.STRING;
import static org.jboss.remotingjmx.protocol.v1.Constants.STRING_ARRAY;
import static org.jboss.remotingjmx.protocol.v1.Constants.SUCCESS;
import static org.jboss.remotingjmx.protocol.v1.Constants.UNREGISTER_MBEAN;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Executor;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
import javax.management.InvalidAttributeValueException;
import javax.management.JMRuntimeException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MBeanServerConnection;
import javax.management.NotCompliantMBeanException;
import javax.management.Notification;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.QueryExp;
import javax.management.ReflectionException;
import org.jboss.logging.Logger;
import org.jboss.marshalling.AbstractClassResolver;
import org.jboss.marshalling.Marshaller;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.remoting3.Channel;
import org.jboss.remoting3.MessageInputStream;
import org.jboss.remotingjmx.ServerMessageInterceptor;
import org.jboss.remotingjmx.ServerMessageInterceptor.Event;
import org.jboss.remotingjmx.VersionedProxy;
import org.jboss.remotingjmx.WrappedMBeanServerConnection;
import org.xnio.IoUtils;
                paramType = unmarshaller.readByte();
                if (paramType != OBJECT) {
                    throw new IOException("Unexpected paramType");
                }
                handback = unmarshaller.readObject();
            } catch (ClassNotFoundException cnfe) {
                throw new IOException(cnfe);
            }

            try {
                if (remoteNotification) {
                    remoteNotificationManager.addNotificationListener(name, listenerId, filter, handback);
                } else {
                    server.getMBeanServerConnection().addNotificationListener(name, listener, filter, handback);
                }

                writeResponse(ADD_NOTIFICATION_LISTENER, correlationId);

                log.tracef("[%d] AddNotificationListener - Success Response Sent", correlationId);
            } catch (InstanceNotFoundException e) {
                writeResponse(e, ADD_NOTIFICATION_LISTENER, correlationId);
                log.tracef("[%d] AddNotificationListener - Failure Response Sent", correlationId);
            }
        }
    }

    private class CreateMBeanHandler implements Common.MessageHandler {

        @Override
        public void handle(DataInput input, final int correlationId) throws IOException {
            log.trace("CreateMBean");
            byte paramType = input.readByte();
            if (paramType != INTEGER) {
                throw new IOException("Unexpected paramType");
            }
            int paramCount = input.readInt();
            String className = null;
            ObjectName name = null;
            ObjectName loader = null;
            Object[] params = null;
            String[] signature = null;
            final ClassLoaderSwitchingClassResolver resolver = new ClassLoaderSwitchingClassResolver(
                    ServerProxy.class.getClassLoader());
            Unmarshaller unmarshaller = prepareForUnMarshalling(input, resolver);
            for (int i = 0; i < paramCount; i++) {
                byte param = unmarshaller.readByte();
                switch (param) {
                    case STRING:
                        if (className == null) {
                            className = unmarshaller.readUTF();
                        } else {
                            throw new IOException("Unexpected paramter");
                        }
                        break;
                    case OBJECT_NAME:
                        try {
                            if (name == null) {
                                name = unmarshaller.readObject(ObjectName.class);
                            } else if (loader == null) {
                                loader = unmarshaller.readObject(ObjectName.class);
                                switchClassLoaderForLoader(loader, resolver);
                            } else {
                                throw new IOException("Unexpected paramter");
                            }
                        } catch (ClassNotFoundException e) {
                            throw new IOException(e);
                        }
                        break;
                    case OBJECT_ARRAY:
                        if (params == null) {
                            int count = unmarshaller.readInt();
                            params = new Object[count];
                            for (int j = 0; j < count; j++) {
                                try {
                                    params[j] = unmarshaller.readObject();
                                } catch (ClassNotFoundException e) {
                                    throw new IOException(e);
                                }
                            }
                        } else {
                            throw new IOException("Unexpected paramter");
                        }

                        break;
                    case STRING_ARRAY:
                        if (signature == null) {
                            int count = unmarshaller.readInt();
                            signature = new String[count];
                            for (int j = 0; j < count; j++) {
                                signature[j] = unmarshaller.readUTF();
                            }
                        } else {
                            throw new IOException("Unexpected paramter");
                        }

                        break;
                    default:
                        throw new IOException("Unexpected paramter");
                }
            }

            try {
                final ObjectInstance instance;
                switch (paramCount) {
                    case 2:
                        instance = server.getMBeanServerConnection().createMBean(className, name);
                        break;
                    case 3:
                        instance = server.getMBeanServerConnection().createMBean(className, name, loader);
                        break;
                    case 4:
                        instance = server.getMBeanServerConnection().createMBean(className, name, params, signature);
                        break;
                    case 5:
                        instance = server.getMBeanServerConnection().createMBean(className, name, loader, params, signature);
                        break;
                    default:
                        throw new IOException("Unable to identify correct create method to call.");
                }

Answer:                 writeResponse(instance, OBJECT_INSTANCE, CREATE_MBEAN, correlationId);