http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionIndividualAcknowledgeMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionIndividualAcknowledgeMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionIndividualAcknowledgeMessage.java
new file mode 100644
index 0000000..4186539
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionIndividualAcknowledgeMessage.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public class SessionIndividualAcknowledgeMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   private long messageID;
+
+   private boolean requiresResponse;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionIndividualAcknowledgeMessage(final long consumerID, final 
long messageID, final boolean requiresResponse)
+   {
+      super(SESS_INDIVIDUAL_ACKNOWLEDGE);
+
+      this.consumerID = consumerID;
+
+      this.messageID = messageID;
+
+      this.requiresResponse = requiresResponse;
+   }
+
+   public SessionIndividualAcknowledgeMessage()
+   {
+      super(SESS_INDIVIDUAL_ACKNOWLEDGE);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public long getMessageID()
+   {
+      return messageID;
+   }
+
+   public boolean isRequiresResponse()
+   {
+      return requiresResponse;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeLong(consumerID);
+
+      buffer.writeLong(messageID);
+
+      buffer.writeBoolean(requiresResponse);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      consumerID = buffer.readLong();
+
+      messageID = buffer.readLong();
+
+      requiresResponse = buffer.readBoolean();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (int)(consumerID ^ (consumerID >>> 32));
+      result = prime * result + (int)(messageID ^ (messageID >>> 32));
+      result = prime * result + (requiresResponse ? 1231 : 1237);
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionIndividualAcknowledgeMessage))
+         return false;
+      SessionIndividualAcknowledgeMessage other = 
(SessionIndividualAcknowledgeMessage)obj;
+      if (consumerID != other.consumerID)
+         return false;
+      if (messageID != other.messageID)
+         return false;
+      if (requiresResponse != other.requiresResponse)
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsFailMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsFailMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsFailMessage.java
new file mode 100644
index 0000000..198bfff
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsFailMessage.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author Justin Bertram
+ *
+ */
+public class SessionProducerCreditsFailMessage extends PacketImpl
+{
+   private int credits;
+
+   private SimpleString address;
+
+   public SessionProducerCreditsFailMessage(final int credits, final 
SimpleString address)
+   {
+      super(SESS_PRODUCER_FAIL_CREDITS);
+
+      this.credits = credits;
+
+      this.address = address;
+   }
+
+   public SessionProducerCreditsFailMessage()
+   {
+      super(SESS_PRODUCER_FAIL_CREDITS);
+   }
+
+   public int getCredits()
+   {
+      return credits;
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeInt(credits);
+      buffer.writeSimpleString(address);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      credits = buffer.readInt();
+      address = buffer.readSimpleString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((address == null) ? 0 : address.hashCode());
+      result = prime * result + credits;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionProducerCreditsFailMessage))
+         return false;
+      SessionProducerCreditsFailMessage other = 
(SessionProducerCreditsFailMessage)obj;
+      if (address == null)
+      {
+         if (other.address != null)
+            return false;
+      }
+      else if (!address.equals(other.address))
+         return false;
+      if (credits != other.credits)
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
new file mode 100644
index 0000000..0446d29
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionProducerCreditsMessage extends PacketImpl
+{
+   private int credits;
+
+   private SimpleString address;
+
+   public SessionProducerCreditsMessage(final int credits, final SimpleString 
address)
+   {
+      super(SESS_PRODUCER_CREDITS);
+
+      this.credits = credits;
+
+      this.address = address;
+   }
+
+   public SessionProducerCreditsMessage()
+   {
+      super(SESS_PRODUCER_CREDITS);
+   }
+
+   public int getCredits()
+   {
+      return credits;
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeInt(credits);
+      buffer.writeSimpleString(address);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      credits = buffer.readInt();
+      address = buffer.readSimpleString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((address == null) ? 0 : address.hashCode());
+      result = prime * result + credits;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionProducerCreditsMessage))
+         return false;
+      SessionProducerCreditsMessage other = (SessionProducerCreditsMessage)obj;
+      if (address == null)
+      {
+         if (other.address != null)
+            return false;
+      }
+      else if (!address.equals(other.address))
+         return false;
+      if (credits != other.credits)
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
new file mode 100644
index 0000000..d2dbfbb
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A SessionQueueQueryMessage
+ *
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionQueueQueryMessage extends PacketImpl
+{
+   private SimpleString queueName;
+
+   public SessionQueueQueryMessage(final SimpleString queueName)
+   {
+      super(SESS_QUEUEQUERY);
+
+      this.queueName = queueName;
+   }
+
+   public SessionQueueQueryMessage()
+   {
+      super(SESS_QUEUEQUERY);
+   }
+
+   public SimpleString getQueueName()
+   {
+      return queueName;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeSimpleString(queueName);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      queueName = buffer.readSimpleString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((queueName == null) ? 0 : 
queueName.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionQueueQueryMessage))
+         return false;
+      SessionQueueQueryMessage other = (SessionQueueQueryMessage)obj;
+      if (queueName == null)
+      {
+         if (other.queueName != null)
+            return false;
+      }
+      else if (!queueName.equals(other.queueName))
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
new file mode 100644
index 0000000..8dec378
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.api.core.client.ClientSession;
+import org.apache.activemq6.core.client.impl.QueueQueryImpl;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.core.server.QueueQueryResult;
+
+/**
+ *
+ * A SessionQueueQueryResponseMessage
+ *
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionQueueQueryResponseMessage extends PacketImpl
+{
+   private SimpleString name;
+
+   private boolean exists;
+
+   private boolean durable;
+
+   private int consumerCount;
+
+   private long messageCount;
+
+   private SimpleString filterString;
+
+   private SimpleString address;
+
+   private boolean temporary;
+
+   public SessionQueueQueryResponseMessage(final QueueQueryResult result)
+   {
+      this(result.getName(), result.getAddress(), result.isDurable(), 
result.isTemporary(),
+           result.getFilterString(), result.getConsumerCount(), 
result.getMessageCount(), result.isExists());
+   }
+
+   public SessionQueueQueryResponseMessage()
+   {
+      this(null, null, false, false, null, 0, 0, false);
+   }
+
+   private SessionQueueQueryResponseMessage(final SimpleString name,
+                                            final SimpleString address,
+                                            final boolean durable,
+                                            final boolean temporary,
+                                            final SimpleString filterString,
+                                            final int consumerCount,
+                                            final long messageCount,
+                                            final boolean exists)
+   {
+      super(SESS_QUEUEQUERY_RESP);
+
+      this.durable = durable;
+
+      this.temporary = temporary;
+
+      this.consumerCount = consumerCount;
+
+      this.messageCount = messageCount;
+
+      this.filterString = filterString;
+
+      this.address = address;
+
+      this.name = name;
+
+      this.exists = exists;
+   }
+
+   @Override
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public boolean isExists()
+   {
+      return exists;
+   }
+
+   public boolean isDurable()
+   {
+      return durable;
+   }
+
+   public int getConsumerCount()
+   {
+      return consumerCount;
+   }
+
+   public long getMessageCount()
+   {
+      return messageCount;
+   }
+
+   public SimpleString getFilterString()
+   {
+      return filterString;
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   public SimpleString getName()
+   {
+      return name;
+   }
+
+   public boolean isTemporary()
+   {
+      return temporary;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeBoolean(exists);
+      buffer.writeBoolean(durable);
+      buffer.writeBoolean(temporary);
+      buffer.writeInt(consumerCount);
+      buffer.writeLong(messageCount);
+      buffer.writeNullableSimpleString(filterString);
+      buffer.writeNullableSimpleString(address);
+      buffer.writeNullableSimpleString(name);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      exists = buffer.readBoolean();
+      durable = buffer.readBoolean();
+      temporary = buffer.readBoolean();
+      consumerCount = buffer.readInt();
+      messageCount = buffer.readLong();
+      filterString = buffer.readNullableSimpleString();
+      address = buffer.readNullableSimpleString();
+      name = buffer.readNullableSimpleString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((address == null) ? 0 : address.hashCode());
+      result = prime * result + consumerCount;
+      result = prime * result + (durable ? 1231 : 1237);
+      result = prime * result + (exists ? 1231 : 1237);
+      result = prime * result + ((filterString == null) ? 0 : 
filterString.hashCode());
+      result = prime * result + (int)(messageCount ^ (messageCount >>> 32));
+      result = prime * result + ((name == null) ? 0 : name.hashCode());
+      result = prime * result + (temporary ? 1231 : 1237);
+      return result;
+   }
+
+   public ClientSession.QueueQuery toQueueQuery()
+   {
+      return new QueueQueryImpl(isDurable(),
+                                isTemporary(),
+                                getConsumerCount(),
+                                getMessageCount(),
+                                getFilterString(),
+                                getAddress(),
+                                getName(),
+                                isExists());
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionQueueQueryResponseMessage))
+         return false;
+      SessionQueueQueryResponseMessage other = 
(SessionQueueQueryResponseMessage)obj;
+      if (address == null)
+      {
+         if (other.address != null)
+            return false;
+      }
+      else if (!address.equals(other.address))
+         return false;
+      if (consumerCount != other.consumerCount)
+         return false;
+      if (durable != other.durable)
+         return false;
+      if (exists != other.exists)
+         return false;
+      if (filterString == null)
+      {
+         if (other.filterString != null)
+            return false;
+      }
+      else if (!filterString.equals(other.filterString))
+         return false;
+      if (messageCount != other.messageCount)
+         return false;
+      if (name == null)
+      {
+         if (other.name != null)
+            return false;
+      }
+      else if (!name.equals(other.name))
+         return false;
+      if (temporary != other.temporary)
+         return false;
+      return true;
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveClientLargeMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveClientLargeMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveClientLargeMessage.java
new file mode 100644
index 0000000..1eb6c1d
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveClientLargeMessage.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.client.impl.ClientLargeMessageInternal;
+import org.apache.activemq6.core.message.impl.MessageInternal;
+
+/**
+ * @author <a href="mailto:[email protected]";>Andy Taylor</a>
+ *         10/12/12
+ */
+public class SessionReceiveClientLargeMessage extends 
SessionReceiveLargeMessage
+{
+   public SessionReceiveClientLargeMessage(MessageInternal message)
+   {
+      super(message);
+   }
+
+   @Override
+   public void decodeRest(HornetQBuffer buffer)
+   {
+      super.decodeRest(buffer);
+
+      
((ClientLargeMessageInternal)getLargeMessage()).setLargeMessageSize(getLargeMessageSize());
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
new file mode 100644
index 0000000..83f6c90
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.utils.DataConstants;
+
+/**
+ * A SessionSendContinuationMessage
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ *
+ * Created Dec 4, 2008 12:25:14 PM
+ *
+ *
+ */
+public class SessionReceiveContinuationMessage extends 
SessionContinuationMessage
+{
+
+   // Constants -----------------------------------------------------
+
+   public static final int SESSION_RECEIVE_CONTINUATION_BASE_SIZE = 
SESSION_CONTINUATION_BASE_SIZE + DataConstants.SIZE_LONG;
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionReceiveContinuationMessage()
+   {
+      super(SESS_RECEIVE_CONTINUATION);
+   }
+
+   /**
+    * @param consumerID
+    * @param body
+    * @param continues
+    * @param requiresResponse
+    */
+   public SessionReceiveContinuationMessage(final long consumerID,
+                                            final byte[] body,
+                                            final boolean continues,
+                                            final boolean requiresResponse)
+   {
+      super(SESS_RECEIVE_CONTINUATION, body, continues);
+      this.consumerID = consumerID;
+   }
+
+   public SessionReceiveContinuationMessage(final long consumerID,
+                                            final byte[] body,
+                                            final boolean continues,
+                                            final boolean requiresResponse,
+                                            final int packetSize)
+   {
+      this(consumerID, body, continues, requiresResponse);
+      this.size = packetSize;
+   }
+
+   /**
+    * @return the consumerID
+    */
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      super.encodeRest(buffer);
+      buffer.writeLong(consumerID);
+   }
+   @Override
+   public int getPacketSize()
+   {
+      if (size == -1)
+      {
+         // This packet was created by the LargeMessageController
+         return 0;
+      }
+      else
+      {
+         return size;
+      }
+   }
+
+
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      super.decodeRest(buffer);
+      consumerID = buffer.readLong();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (int)(consumerID ^ (consumerID >>> 32));
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionReceiveContinuationMessage))
+         return false;
+      SessionReceiveContinuationMessage other = 
(SessionReceiveContinuationMessage)obj;
+      if (consumerID != other.consumerID)
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
new file mode 100644
index 0000000..7d872e8
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.message.impl.MessageInternal;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A SessionReceiveLargeMessage
+ *
+ * @author Clebert Suconic
+ *
+ *
+ */
+public class SessionReceiveLargeMessage extends PacketImpl
+{
+   private final MessageInternal message;
+
+   /** Since we receive the message before the entire message was received, */
+   private long largeMessageSize;
+
+   private long consumerID;
+
+   private int deliveryCount;
+
+   // To be used on decoding at the client while receiving a large message
+   public SessionReceiveLargeMessage(final MessageInternal message)
+   {
+      super(SESS_RECEIVE_LARGE_MSG);
+      this.message = message;
+   }
+
+   public SessionReceiveLargeMessage(final long consumerID,
+                                     final MessageInternal message,
+                                     final long largeMessageSize,
+                                     final int deliveryCount)
+   {
+      super(SESS_RECEIVE_LARGE_MSG);
+
+      this.consumerID = consumerID;
+
+      this.message = message;
+
+      this.deliveryCount = deliveryCount;
+
+      this.largeMessageSize = largeMessageSize;
+   }
+
+   public MessageInternal getLargeMessage()
+   {
+      return message;
+   }
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public int getDeliveryCount()
+   {
+      return deliveryCount;
+   }
+
+   /**
+    * @return the largeMessageSize
+    */
+   public long getLargeMessageSize()
+   {
+      return largeMessageSize;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeLong(consumerID);
+      buffer.writeInt(deliveryCount);
+      buffer.writeLong(largeMessageSize);
+      message.encodeHeadersAndProperties(buffer);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      consumerID = buffer.readLong();
+      deliveryCount = buffer.readInt();
+      largeMessageSize = buffer.readLong();
+      message.decodeHeadersAndProperties(buffer);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (int)(consumerID ^ (consumerID >>> 32));
+      result = prime * result + deliveryCount;
+      result = prime * result + (int)(largeMessageSize ^ (largeMessageSize >>> 
32));
+      result = prime * result + ((message == null) ? 0 : message.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionReceiveLargeMessage))
+         return false;
+      SessionReceiveLargeMessage other = (SessionReceiveLargeMessage)obj;
+      if (consumerID != other.consumerID)
+         return false;
+      if (deliveryCount != other.deliveryCount)
+         return false;
+      if (largeMessageSize != other.largeMessageSize)
+         return false;
+      if (message == null)
+      {
+         if (other.message != null)
+            return false;
+      }
+      else if (!message.equals(other.message))
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
new file mode 100644
index 0000000..87b6966
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.message.impl.MessageInternal;
+import org.apache.activemq6.spi.core.protocol.RemotingConnection;
+import org.apache.activemq6.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionReceiveMessage extends MessagePacket
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   private int deliveryCount;
+
+   public SessionReceiveMessage(final long consumerID, final MessageInternal 
message, final int deliveryCount)
+   {
+      super(SESS_RECEIVE_MSG, message);
+
+      this.consumerID = consumerID;
+
+      this.deliveryCount = deliveryCount;
+   }
+
+   public SessionReceiveMessage(final MessageInternal message)
+   {
+      super(SESS_RECEIVE_MSG, message);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public int getDeliveryCount()
+   {
+      return deliveryCount;
+   }
+
+   @Override
+   public HornetQBuffer encode(final RemotingConnection connection)
+   {
+      HornetQBuffer buffer = message.getEncodedBuffer();
+
+      // Sanity check
+      if (buffer.writerIndex() != message.getEndOfMessagePosition())
+      {
+         throw new IllegalStateException("Wrong encode position");
+      }
+
+      buffer.writeLong(consumerID);
+      buffer.writeInt(deliveryCount);
+
+      size = buffer.writerIndex();
+
+      // Write standard headers
+
+      int len = size - DataConstants.SIZE_INT;
+      buffer.setInt(0, len);
+      buffer.setByte(DataConstants.SIZE_INT, getType());
+      buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, 
channelID);
+
+      // Position reader for reading by Netty
+      buffer.setIndex(0, size);
+
+      return buffer;
+   }
+
+   @Override
+   public void decode(final HornetQBuffer buffer)
+   {
+      channelID = buffer.readLong();
+
+      message.decodeFromBuffer(buffer);
+
+      consumerID = buffer.readLong();
+
+      deliveryCount = buffer.readInt();
+
+      size = buffer.readerIndex();
+
+      // Need to position buffer for reading
+
+      buffer.setIndex(PACKET_HEADERS_SIZE + DataConstants.SIZE_INT, 
message.getEndOfBodyPosition());
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (int)(consumerID ^ (consumerID >>> 32));
+      result = prime * result + deliveryCount;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionReceiveMessage))
+         return false;
+      SessionReceiveMessage other = (SessionReceiveMessage)obj;
+      if (consumerID != other.consumerID)
+         return false;
+      if (deliveryCount != other.deliveryCount)
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
new file mode 100644
index 0000000..992a507
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionRequestProducerCreditsMessage extends PacketImpl
+{
+   private int credits;
+
+   private SimpleString address;
+
+   public SessionRequestProducerCreditsMessage(final int credits, final 
SimpleString address)
+   {
+      super(SESS_PRODUCER_REQUEST_CREDITS);
+
+      this.credits = credits;
+
+      this.address = address;
+   }
+
+   public SessionRequestProducerCreditsMessage()
+   {
+      super(SESS_PRODUCER_REQUEST_CREDITS);
+   }
+
+   // Public --------------------------------------------------------
+
+   public int getCredits()
+   {
+      return credits;
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   // public boolean isRequiresConfirmations()
+   // {
+   // return false;
+   // }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeInt(credits);
+      buffer.writeSimpleString(address);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      credits = buffer.readInt();
+      address = buffer.readSimpleString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((address == null) ? 0 : address.hashCode());
+      result = prime * result + credits;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionRequestProducerCreditsMessage))
+         return false;
+      SessionRequestProducerCreditsMessage other = 
(SessionRequestProducerCreditsMessage)obj;
+      if (address == null)
+      {
+         if (other.address != null)
+            return false;
+      }
+      else if (!address.equals(other.address))
+         return false;
+      if (credits != other.credits)
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
new file mode 100644
index 0000000..ba792f1
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.client.SendAcknowledgementHandler;
+import org.apache.activemq6.core.message.impl.MessageInternal;
+
+/**
+ * A SessionSendContinuationMessage<br>
+ * Created Dec 4, 2008 12:25:14 PM
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ */
+public class SessionSendContinuationMessage extends SessionContinuationMessage
+{
+   private boolean requiresResponse;
+
+   // Used on confirmation handling
+   private MessageInternal message;
+   /**
+    * In case, we are using a different handler than the one set on the {@link 
org.apache.activemq6.api.core.client.ClientSession}
+    * <p/>
+    * This field is only used at the client side.
+    *
+    * @see 
org.apache.activemq6.api.core.client.ClientSession#setSendAcknowledgementHandler(SendAcknowledgementHandler)
+    * @see 
org.apache.activemq6.api.core.client.ClientProducer#send(org.hornetq.api.core.SimpleString,
 org.hornetq.api.core.Message, SendAcknowledgementHandler)
+    */
+   private final transient SendAcknowledgementHandler handler;
+
+   /**
+    * to be sent on the last package
+    */
+   private long messageBodySize = -1;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionSendContinuationMessage()
+   {
+      super(SESS_SEND_CONTINUATION);
+      handler = null;
+   }
+
+   /**
+    * @param body
+    * @param continues
+    * @param requiresResponse
+    */
+   public SessionSendContinuationMessage(final MessageInternal message, final 
byte[] body, final boolean continues,
+                                         final boolean requiresResponse, final 
long messageBodySize,
+                                         SendAcknowledgementHandler handler)
+   {
+      super(SESS_SEND_CONTINUATION, body, continues);
+      this.requiresResponse = requiresResponse;
+      this.message = message;
+      this.handler = handler;
+      this.messageBodySize = messageBodySize;
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * @return the requiresResponse
+    */
+   public boolean isRequiresResponse()
+   {
+      return requiresResponse;
+   }
+
+   public long getMessageBodySize()
+   {
+      return messageBodySize;
+   }
+
+
+   /**
+    * @return the message
+    */
+   public MessageInternal getMessage()
+   {
+      return message;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      super.encodeRest(buffer);
+      if (!continues)
+      {
+         buffer.writeLong(messageBodySize);
+      }
+      buffer.writeBoolean(requiresResponse);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      super.decodeRest(buffer);
+      if (!continues)
+      {
+         messageBodySize = buffer.readLong();
+      }
+      requiresResponse = buffer.readBoolean();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((message == null) ? 0 : message.hashCode());
+      result = prime * result + (int) (messageBodySize ^ (messageBodySize >>> 
32));
+      result = prime * result + (requiresResponse ? 1231 : 1237);
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionSendContinuationMessage))
+         return false;
+      SessionSendContinuationMessage other = (SessionSendContinuationMessage) 
obj;
+      if (message == null)
+      {
+         if (other.message != null)
+            return false;
+      }
+      else if (!message.equals(other.message))
+         return false;
+      if (messageBodySize != other.messageBodySize)
+         return false;
+      if (requiresResponse != other.requiresResponse)
+         return false;
+      return true;
+   }
+
+   public SendAcknowledgementHandler getHandler()
+   {
+      return handler;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
new file mode 100644
index 0000000..7857bae
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.message.impl.MessageInternal;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ *
+ */
+public class SessionSendLargeMessage extends PacketImpl
+{
+
+
+   /** Used only if largeMessage */
+   private final MessageInternal largeMessage;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionSendLargeMessage(final MessageInternal largeMessage)
+   {
+      super(SESS_SEND_LARGE);
+
+      this.largeMessage = largeMessage;
+   }
+
+   // Public --------------------------------------------------------
+
+   public MessageInternal getLargeMessage()
+   {
+      return largeMessage;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      largeMessage.encodeHeadersAndProperties(buffer);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      largeMessage.decodeHeadersAndProperties(buffer);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((largeMessage == null) ? 0 : 
largeMessage.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionSendLargeMessage))
+         return false;
+      SessionSendLargeMessage other = (SessionSendLargeMessage)obj;
+      if (largeMessage == null)
+      {
+         if (other.largeMessage != null)
+            return false;
+      }
+      else if (!largeMessage.equals(other.largeMessage))
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendMessage.java
new file mode 100644
index 0000000..3547845
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionSendMessage.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.client.SendAcknowledgementHandler;
+import org.apache.activemq6.core.message.impl.MessageInternal;
+import org.apache.activemq6.spi.core.protocol.RemotingConnection;
+import org.apache.activemq6.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public class SessionSendMessage extends MessagePacket
+{
+
+   private boolean requiresResponse;
+
+   /**
+    * In case, we are using a different handler than the one set on the {@link 
org.apache.activemq6.api.core.client.ClientSession}
+    * <p/>
+    * This field is only used at the client side.
+    *
+    * @see 
org.apache.activemq6.api.core.client.ClientSession#setSendAcknowledgementHandler(SendAcknowledgementHandler)
+    * @see 
org.apache.activemq6.api.core.client.ClientProducer#send(org.hornetq.api.core.SimpleString,
 org.hornetq.api.core.Message, SendAcknowledgementHandler)
+    */
+   private final transient SendAcknowledgementHandler handler;
+
+   public SessionSendMessage(final MessageInternal message, final boolean 
requiresResponse,
+                             final SendAcknowledgementHandler handler)
+   {
+      super(SESS_SEND, message);
+      this.handler = handler;
+      this.requiresResponse = requiresResponse;
+   }
+
+   public SessionSendMessage(final MessageInternal message)
+   {
+      super(SESS_SEND, message);
+      this.handler = null;
+   }
+
+   // Public --------------------------------------------------------
+
+   public boolean isRequiresResponse()
+   {
+      return requiresResponse;
+   }
+
+   public SendAcknowledgementHandler getHandler()
+   {
+      return handler;
+   }
+
+   @Override
+   public HornetQBuffer encode(final RemotingConnection connection)
+   {
+      HornetQBuffer buffer = message.getEncodedBuffer();
+
+      // Sanity check
+      if (buffer.writerIndex() != message.getEndOfMessagePosition())
+      {
+         throw new IllegalStateException("Wrong encode position");
+      }
+
+      buffer.writeBoolean(requiresResponse);
+
+      size = buffer.writerIndex();
+
+      // Write standard headers
+
+      int len = size - DataConstants.SIZE_INT;
+      buffer.setInt(0, len);
+      buffer.setByte(DataConstants.SIZE_INT, getType());
+      buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, 
channelID);
+
+      // Position reader for reading by Netty
+      buffer.readerIndex(0);
+
+      message.resetCopied();
+
+      return buffer;
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      // Buffer comes in after having read standard headers and positioned at 
Beginning of body part
+
+      message.decodeFromBuffer(buffer);
+
+      int ri = buffer.readerIndex();
+
+      requiresResponse = buffer.readBoolean();
+
+      buffer.readerIndex(ri);
+
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (requiresResponse ? 1231 : 1237);
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionSendMessage))
+         return false;
+      SessionSendMessage other = (SessionSendMessage) obj;
+      if (requiresResponse != other.requiresResponse)
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionUniqueAddMetaDataMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionUniqueAddMetaDataMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionUniqueAddMetaDataMessage.java
new file mode 100644
index 0000000..6b86bfc
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionUniqueAddMetaDataMessage.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+
+/**
+ * A SessionUniqueAddMetaDataMessageV2
+ *
+ * @author clebertsuconic
+ *
+ *
+ */
+public class SessionUniqueAddMetaDataMessage extends 
SessionAddMetaDataMessageV2
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionUniqueAddMetaDataMessage()
+   {
+      super(SESS_UNIQUE_ADD_METADATA);
+   }
+
+
+   public SessionUniqueAddMetaDataMessage(String key, String data)
+   {
+      super(SESS_UNIQUE_ADD_METADATA, key, data);
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAAfterFailedMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAAfterFailedMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAAfterFailedMessage.java
new file mode 100644
index 0000000..9ebd029
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAAfterFailedMessage.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * to be called after a failure on an XA Session
+ * @author Clebert Suconic
+ */
+
+public class SessionXAAfterFailedMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private Xid xid;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAAfterFailedMessage(final Xid xid)
+   {
+      super(SESS_XA_FAILED);
+
+      this.xid = xid;
+   }
+
+   public SessionXAAfterFailedMessage()
+   {
+      super(SESS_XA_FAILED);
+   }
+
+   // Public --------------------------------------------------------
+
+   public Xid getXid()
+   {
+      return xid;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((xid == null) ? 0 : xid.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAAfterFailedMessage))
+         return false;
+      SessionXAAfterFailedMessage other = (SessionXAAfterFailedMessage)obj;
+      if (xid == null)
+      {
+         if (other.xid != null)
+            return false;
+      }
+      else if (!xid.equals(other.xid))
+         return false;
+      return true;
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
new file mode 100644
index 0000000..1fe0acf
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionXACommitMessage extends PacketImpl
+{
+   private boolean onePhase;
+
+   private Xid xid;
+
+   public SessionXACommitMessage(final Xid xid, final boolean onePhase)
+   {
+      super(SESS_XA_COMMIT);
+
+      this.xid = xid;
+      this.onePhase = onePhase;
+   }
+
+   public SessionXACommitMessage()
+   {
+      super(SESS_XA_COMMIT);
+   }
+
+   public Xid getXid()
+   {
+      return xid;
+   }
+
+   public boolean isOnePhase()
+   {
+      return onePhase;
+   }
+
+   @Override
+   public boolean isAsyncExec()
+   {
+      return true;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+      buffer.writeBoolean(onePhase);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+      onePhase = buffer.readBoolean();
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", xid=" + xid + ", onePhase=" + onePhase + 
"]";
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (onePhase ? 1231 : 1237);
+      result = prime * result + ((xid == null) ? 0 : xid.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXACommitMessage))
+         return false;
+      SessionXACommitMessage other = (SessionXACommitMessage)obj;
+      if (onePhase != other.onePhase)
+         return false;
+      if (xid == null)
+      {
+         if (other.xid != null)
+            return false;
+      }
+      else if (!xid.equals(other.xid))
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
new file mode 100644
index 0000000..8c75fb7
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public class SessionXAEndMessage extends PacketImpl
+{
+   private Xid xid;
+
+   private boolean failed;
+
+   public SessionXAEndMessage(final Xid xid, final boolean failed)
+   {
+      super(SESS_XA_END);
+
+      this.xid = xid;
+
+      this.failed = failed;
+   }
+
+   public SessionXAEndMessage()
+   {
+      super(SESS_XA_END);
+   }
+
+   public boolean isFailed()
+   {
+      return failed;
+   }
+
+   public Xid getXid()
+   {
+      return xid;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+      buffer.writeBoolean(failed);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+      failed = buffer.readBoolean();
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", xid=" + xid + ", failed=" + failed + "]";
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (failed ? 1231 : 1237);
+      result = prime * result + ((xid == null) ? 0 : xid.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAEndMessage))
+         return false;
+      SessionXAEndMessage other = (SessionXAEndMessage)obj;
+      if (failed != other.failed)
+         return false;
+      if (xid == null)
+      {
+         if (other.xid != null)
+            return false;
+      }
+      else if (!xid.equals(other.xid))
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
new file mode 100644
index 0000000..51269e2
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public class SessionXAForgetMessage extends PacketImpl
+{
+
+   private Xid xid;
+   public SessionXAForgetMessage(final Xid xid)
+   {
+      super(SESS_XA_FORGET);
+
+      this.xid = xid;
+   }
+
+   public SessionXAForgetMessage()
+   {
+      super(SESS_XA_FORGET);
+   }
+
+   public Xid getXid()
+   {
+      return xid;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((xid == null) ? 0 : xid.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAForgetMessage))
+         return false;
+      SessionXAForgetMessage other = (SessionXAForgetMessage)obj;
+      if (xid == null)
+      {
+         if (other.xid != null)
+            return false;
+      }
+      else if (!xid.equals(other.xid))
+         return false;
+      return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
new file mode 100644
index 0000000..0bd0dde
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl
+{
+   private List<Xid> xids;
+
+   public SessionXAGetInDoubtXidsResponseMessage(final List<Xid> xids)
+   {
+      super(SESS_XA_INDOUBT_XIDS_RESP);
+
+      this.xids = xids;
+   }
+
+   public SessionXAGetInDoubtXidsResponseMessage()
+   {
+      super(SESS_XA_INDOUBT_XIDS_RESP);
+   }
+
+   @Override
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public List<Xid> getXids()
+   {
+      return xids;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeInt(xids.size());
+
+      for (Xid xid : xids)
+      {
+         XidCodecSupport.encodeXid(xid, buffer);
+      }
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      int len = buffer.readInt();
+      xids = new ArrayList<Xid>(len);
+      for (int i = 0; i < len; i++)
+      {
+         Xid xid = XidCodecSupport.decodeXid(buffer);
+
+         xids.add(xid);
+      }
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((xids == null) ? 0 : xids.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAGetInDoubtXidsResponseMessage))
+         return false;
+      SessionXAGetInDoubtXidsResponseMessage other = 
(SessionXAGetInDoubtXidsResponseMessage)obj;
+      if (xids == null)
+      {
+         if (other.xids != null)
+            return false;
+      }
+      else if (!xids.equals(other.xids))
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
new file mode 100644
index 0000000..773fdd5
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionXAGetTimeoutResponseMessage extends PacketImpl
+{
+   private int timeoutSeconds;
+
+   public SessionXAGetTimeoutResponseMessage(final int timeoutSeconds)
+   {
+      super(SESS_XA_GET_TIMEOUT_RESP);
+
+      this.timeoutSeconds = timeoutSeconds;
+   }
+
+   public SessionXAGetTimeoutResponseMessage()
+   {
+      super(SESS_XA_GET_TIMEOUT_RESP);
+   }
+
+   @Override
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public int getTimeoutSeconds()
+   {
+      return timeoutSeconds;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeInt(timeoutSeconds);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      timeoutSeconds = buffer.readInt();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + timeoutSeconds;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAGetTimeoutResponseMessage))
+         return false;
+      SessionXAGetTimeoutResponseMessage other = 
(SessionXAGetTimeoutResponseMessage)obj;
+      if (timeoutSeconds != other.timeoutSeconds)
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
new file mode 100644
index 0000000..af64efe
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionXAJoinMessage extends PacketImpl
+{
+   private Xid xid;
+
+   public SessionXAJoinMessage(final Xid xid)
+   {
+      super(SESS_XA_JOIN);
+
+      this.xid = xid;
+   }
+
+   public SessionXAJoinMessage()
+   {
+      super(SESS_XA_JOIN);
+   }
+
+   public Xid getXid()
+   {
+      return xid;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((xid == null) ? 0 : xid.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAJoinMessage))
+         return false;
+      SessionXAJoinMessage other = (SessionXAJoinMessage)obj;
+      if (xid == null)
+      {
+         if (other.xid != null)
+            return false;
+      }
+      else if (!xid.equals(other.xid))
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
new file mode 100644
index 0000000..7b014d2
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq6.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ *
+ */
+public class SessionXAPrepareMessage extends PacketImpl
+{
+
+   private Xid xid;
+
+   public SessionXAPrepareMessage(final Xid xid)
+   {
+      super(SESS_XA_PREPARE);
+
+      this.xid = xid;
+   }
+
+   public SessionXAPrepareMessage()
+   {
+      super(SESS_XA_PREPARE);
+   }
+
+
+   public Xid getXid()
+   {
+      return xid;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+
+   @Override
+   public boolean isAsyncExec()
+   {
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + ((xid == null) ? 0 : xid.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAPrepareMessage))
+         return false;
+      SessionXAPrepareMessage other = (SessionXAPrepareMessage)obj;
+      if (xid == null)
+      {
+         if (other.xid != null)
+            return false;
+      }
+      else if (!xid.equals(other.xid))
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
new file mode 100644
index 0000000..36e6b70
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.core.protocol.core.impl.wireformat;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public class SessionXAResponseMessage extends PacketImpl
+{
+   private boolean error;
+
+   private int responseCode;
+
+   private String message;
+
+   public SessionXAResponseMessage(final boolean isError, final int 
responseCode, final String message)
+   {
+      super(SESS_XA_RESP);
+
+      error = isError;
+
+      this.responseCode = responseCode;
+
+      this.message = message;
+   }
+
+   public SessionXAResponseMessage()
+   {
+      super(SESS_XA_RESP);
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public boolean isError()
+   {
+      return error;
+   }
+
+   public int getResponseCode()
+   {
+      return responseCode;
+   }
+
+   public String getMessage()
+   {
+      return message;
+   }
+
+   @Override
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+      buffer.writeBoolean(error);
+      buffer.writeInt(responseCode);
+      buffer.writeNullableString(message);
+   }
+
+   @Override
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+      error = buffer.readBoolean();
+      responseCode = buffer.readInt();
+      message = buffer.readNullableString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (error ? 1231 : 1237);
+      result = prime * result + ((message == null) ? 0 : message.hashCode());
+      result = prime * result + responseCode;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionXAResponseMessage))
+         return false;
+      SessionXAResponseMessage other = (SessionXAResponseMessage)obj;
+      if (error != other.error)
+         return false;
+      if (message == null)
+      {
+         if (other.message != null)
+            return false;
+      }
+      else if (!message.equals(other.message))
+         return false;
+      if (responseCode != other.responseCode)
+         return false;
+      return true;
+   }
+}

Reply via email to