src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte INTEGER = 0x0B;
src/main/java/org/jboss/remotingjmx/VersionedConnection.java
public interface VersionedConnection extends Closeable {

    String getConnectionId();

    MBeanServerConnection getMBeanServerConnection(Subject subject);

    void close();

}
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte SET_ATTRIBUTE = 0x0A;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte NOTIFICATION = 0x11;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte CREATE_MBEAN = 0x01;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte STRING = 0x08;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte INSTANCE_OF = 0x10;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte NOTIFICATION_FILTER = 0x10;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte OBJECT_INSTANCE = 0x0C;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte UNREGISTER_MBEAN = 0x02;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte SET_ATTRIBUTES = 0x0B;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte ATTRIBUTE = 0x01;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte QUERY_NAMES = 0x05;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte QUERY_EXP = 0x07;
src/main/java/org/jboss/remotingjmx/RemotingMBeanServerConnection.java
public interface RemotingMBeanServerConnection extends MBeanServerConnection {

    Connection getConnection();

}
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte REMOVE_NOTIFICATION_LISTENER = 0x12;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_ATTRIBUTE = 0x08;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte OBJECT_ARRAY = 0x05;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte RESPONSE_MASK = (byte) 0x80;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte INTEGER_ARRAY = 0x12;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte VOID = 0x00; // Not actually passed as a parameter but used internally to indicate no parameter expected.
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte SET_OBJECT_INSTANCE = 0x0D;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte SET_OBJECT_NAME = 0x0F;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte QUERY_MBEANS = 0x04;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte SEND_NOTIFICATION = 0x13;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_OBJECT_INSTANCE = 0x03;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte IS_REGISTERED = 0x06;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte OBJECT = 0x04;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_ATTRIBUTES = 0x09;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_DOMAINS = 0x0E;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte BOOLEAN = 0x0A;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_DEFAULT_DOMAIN = 0x0D;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte ADD_NOTIFICATION_LISTENER = 0x11;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte INVOKE = 0x0C;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte MBEAN_INFO = 0x0E;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte STRING_ARRAY = 0x09;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_MBEAN_COUNT = 0x07;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte OBJECT_NAME = 0x06;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte GET_MBEAN_INFO = 0x0F;
src/main/java/org/jboss/remotingjmx/protocol/v2/Constants.java
static final byte ATTRIBUTE_LIST = 0x02;


Question: import static org.jboss.remotingjmx.protocol.v2.Constants.ADD_NOTIFICATION_LISTENER;
import static org.jboss.remotingjmx.protocol.v2.Constants.ATTRIBUTE;
import static org.jboss.remotingjmx.protocol.v2.Constants.ATTRIBUTE_LIST;
import static org.jboss.remotingjmx.protocol.v2.Constants.BOOLEAN;
import static org.jboss.remotingjmx.protocol.v2.Constants.CREATE_MBEAN;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_ATTRIBUTE;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_ATTRIBUTES;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_DEFAULT_DOMAIN;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_DOMAINS;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_MBEAN_COUNT;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_MBEAN_INFO;
import static org.jboss.remotingjmx.protocol.v2.Constants.GET_OBJECT_INSTANCE;
import static org.jboss.remotingjmx.protocol.v2.Constants.INSTANCE_OF;
import static org.jboss.remotingjmx.protocol.v2.Constants.INTEGER;
import static org.jboss.remotingjmx.protocol.v2.Constants.INTEGER_ARRAY;
import static org.jboss.remotingjmx.protocol.v2.Constants.INVOKE;
import static org.jboss.remotingjmx.protocol.v2.Constants.IS_REGISTERED;
import static org.jboss.remotingjmx.protocol.v2.Constants.MBEAN_INFO;
import static org.jboss.remotingjmx.protocol.v2.Constants.NOTIFICATION;
import static org.jboss.remotingjmx.protocol.v2.Constants.NOTIFICATION_FILTER;
import static org.jboss.remotingjmx.protocol.v2.Constants.OBJECT;
import static org.jboss.remotingjmx.protocol.v2.Constants.OBJECT_ARRAY;
import static org.jboss.remotingjmx.protocol.v2.Constants.OBJECT_INSTANCE;
import static org.jboss.remotingjmx.protocol.v2.Constants.OBJECT_NAME;
import static org.jboss.remotingjmx.protocol.v2.Constants.QUERY_EXP;
import static org.jboss.remotingjmx.protocol.v2.Constants.QUERY_MBEANS;
import static org.jboss.remotingjmx.protocol.v2.Constants.QUERY_NAMES;
import static org.jboss.remotingjmx.protocol.v2.Constants.REMOVE_NOTIFICATION_LISTENER;
import static org.jboss.remotingjmx.protocol.v2.Constants.RESPONSE_MASK;
import static org.jboss.remotingjmx.protocol.v2.Constants.SEND_NOTIFICATION;
import static org.jboss.remotingjmx.protocol.v2.Constants.SET_ATTRIBUTE;
import static org.jboss.remotingjmx.protocol.v2.Constants.SET_ATTRIBUTES;
import static org.jboss.remotingjmx.protocol.v2.Constants.SET_OBJECT_INSTANCE;
import static org.jboss.remotingjmx.protocol.v2.Constants.SET_OBJECT_NAME;
import static org.jboss.remotingjmx.protocol.v2.Constants.STRING;
import static org.jboss.remotingjmx.protocol.v2.Constants.STRING_ARRAY;
import static org.jboss.remotingjmx.protocol.v2.Constants.UNREGISTER_MBEAN;
import static org.jboss.remotingjmx.protocol.v2.Constants.VOID;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
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.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 javax.security.auth.Subject;
import org.jboss.logging.Logger;
import org.jboss.marshalling.Marshaller;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.remoting3.Channel;
import org.jboss.remoting3.Connection;
import org.jboss.remotingjmx.RemotingMBeanServerConnection;
import org.jboss.remotingjmx.VersionedConnection;
import org.xnio.IoFuture;
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.remotingjmx.protocol.v2;





/**
 * The VersionOne client connection.
 *
 * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
 */
class ClientConnection extends ClientCommon implements VersionedConnection {

    private static final Logger log = Logger.getLogger(ClientConnection.class);

    private final Channel channel;
    // Registry of handlers for the incoming messages.
    private final Map<Byte, Common.MessageHandler> handlerRegistry;

    private final String connectionId;
    private TheConnection mbeanServerConnection;
    private final ClientRequestManager clientRequestManager;
    private final ClientExecutorManager clientExecutorManager;
    private LocalNotificationManager localNotificationManager;

    ClientConnection(final Channel channel, final Map<String, ?> environment, final ClientRequestManager clientRequestManager,
            final ClientExecutorManager clientExecutorManager, final String connectionId) {
        super(channel, environment);
        this.channel = channel;
        this.clientRequestManager = clientRequestManager;
        this.clientExecutorManager = clientExecutorManager;
        this.connectionId = connectionId;
        handlerRegistry = createHandlerRegistry();
    }

    private Map<Byte, Common.MessageHandler> createHandlerRegistry() {
        Map<Byte, Common.MessageHandler> registry = new HashMap<Byte, Common.MessageHandler>();
        registry.put((byte) (ADD_NOTIFICATION_LISTENER ^ RESPONSE_MASK), new MarshalledResponseHandler<Void>(VOID));
        registry.put((byte) (CREATE_MBEAN ^ RESPONSE_MASK), new MarshalledResponseHandler<ObjectInstance>(OBJECT_INSTANCE));
        registry.put((byte) (GET_ATTRIBUTE ^ RESPONSE_MASK), new MarshalledResponseHandler<Object>(OBJECT));
        registry.put((byte) (GET_ATTRIBUTES ^ RESPONSE_MASK), new MarshalledResponseHandler<AttributeList>(ATTRIBUTE_LIST));
        registry.put((byte) (GET_DEFAULT_DOMAIN ^ RESPONSE_MASK), new StringResponseHandler());
        registry.put((byte) (GET_DOMAINS ^ RESPONSE_MASK), new StringArrayResponseHandler());
        registry.put((byte) (GET_MBEAN_COUNT ^ RESPONSE_MASK), new IntegerResponseHandler());
        registry.put((byte) (GET_MBEAN_INFO ^ RESPONSE_MASK), new MarshalledResponseHandler<MBeanInfo>(MBEAN_INFO));
        registry.put((byte) (GET_OBJECT_INSTANCE ^ RESPONSE_MASK), new MarshalledResponseHandler<ObjectInstance>(
                OBJECT_INSTANCE));
        registry.put((byte) (INSTANCE_OF ^ RESPONSE_MASK), new BooleanResponseHandler());
        registry.put((byte) (IS_REGISTERED ^ RESPONSE_MASK), new BooleanResponseHandler());
        registry.put((byte) (INVOKE ^ RESPONSE_MASK), new MarshalledResponseHandler<Object>(OBJECT));
        registry.put((byte) (QUERY_MBEANS ^ RESPONSE_MASK), new MarshalledResponseHandler<Set<ObjectInstance>>(
                SET_OBJECT_INSTANCE));
Answer:         registry.put((byte) (QUERY_NAMES ^ RESPONSE_MASK), new MarshalledResponseHandler<Set<ObjectName>>(SET_OBJECT_NAME));