[hornetq-commits] JBoss hornetq SVN: r8831 - in trunk: src/main/org/hornetq/api/core and 37 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 21 15:07:25 EST 2010


Author: timfox
Date: 2010-01-21 15:07:20 -0500 (Thu, 21 Jan 2010)
New Revision: 8831

Added:
   trunk/src/main/org/hornetq/core/protocol/core/impl/
   trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/
   trunk/src/main/org/hornetq/spi/core/protocol/
   trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java
   trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
   trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java
   trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
   trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java
   trunk/src/main/org/hornetq/utils/XidCodecSupport.java
Removed:
   trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java
   trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java
   trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java
   trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java
   trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java
   trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/XidCodecSupport.java
   trunk/src/main/org/hornetq/core/protocol/core/wireformat/
   trunk/src/main/org/hornetq/core/remoting/ProtocolType.java
   trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java
   trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java
   trunk/src/main/org/hornetq/core/remoting/impl/wireformat/
   trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java
   trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java
   trunk/src/main/org/hornetq/core/server/SessionCallback.java
Modified:
   trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java
   trunk/src/main/org/hornetq/api/core/Interceptor.java
   trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
   trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java
   trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
   trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
   trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java
   trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java
   trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java
   trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
   trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
   trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
   trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
   trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
   trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java
   trunk/src/main/org/hornetq/core/protocol/core/Packet.java
   trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
   trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
   trunk/src/main/org/hornetq/core/remoting/CloseListener.java
   trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
   trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
   trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
   trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java
   trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java
   trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
   trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
   trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
   trunk/src/main/org/hornetq/core/server/HornetQServer.java
   trunk/src/main/org/hornetq/core/server/ServerSession.java
   trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
   trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
   trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
   trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
   trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
   trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
   trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
   trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
   trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
   trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
   trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java
   trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
   trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
   trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java
   trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java
   trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
   trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java
   trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
   trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java
   trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java
   trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
   trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
Log:
refactoring to abstract out protocol

Modified: trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java
===================================================================
--- trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,8 +18,8 @@
 import org.hornetq.api.core.Message;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A simple Interceptor implementation

Modified: trunk/src/main/org/hornetq/api/core/Interceptor.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/Interceptor.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/api/core/Interceptor.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -15,7 +15,7 @@
 
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * This is class is a simple way to intercepting calls on HornetQ client and servers.

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,11 +26,11 @@
 import org.hornetq.core.list.impl.PriorityLinkedListImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
 import org.hornetq.utils.Future;
 import org.hornetq.utils.TokenBucketLimiter;
 

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,9 +17,9 @@
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.client.ClientConsumer;
 import org.hornetq.api.core.client.ClientMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,9 +25,9 @@
 import org.hornetq.core.message.BodyEncoder;
 import org.hornetq.core.message.impl.MessageInternal;
 import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
 import org.hornetq.utils.TokenBucketLimiter;
 import org.hornetq.utils.UUIDGenerator;
 

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -37,43 +37,43 @@
 import org.hornetq.core.protocol.core.CommandConfirmationHandler;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
 import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.utils.ConcurrentHashSet;
 import org.hornetq.utils.IDGenerator;

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,10 +17,10 @@
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A ClientSessionInternal

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,21 +13,21 @@
 
 package org.hornetq.core.client.impl;
 
-import static org.hornetq.core.protocol.core.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
 
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Channel;
 import org.hornetq.core.protocol.core.ChannelHandler;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
 
 /**
  *

Modified: trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,10 +28,10 @@
 import org.hornetq.api.core.client.SessionFailureListener;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.utils.ConcurrentHashSet;
 
 /**

Modified: trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -39,15 +39,15 @@
 import org.hornetq.core.protocol.core.ChannelHandler;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.Ping;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
 import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
 import org.hornetq.spi.core.remoting.Connector;

Modified: trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,7 +30,7 @@
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
 import org.hornetq.utils.DataConstants;
 import org.hornetq.utils.UTF8Util;
 import org.jboss.netty.buffer.ChannelBuffer;

Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -46,7 +46,6 @@
 import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
 import org.hornetq.core.persistence.StorageManager;
 import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.server.RemotingService;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.JournalType;
@@ -54,6 +53,7 @@
 import org.hornetq.core.transaction.ResourceManager;
 import org.hornetq.core.transaction.Transaction;
 import org.hornetq.core.transaction.impl.XidImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.utils.json.JSONArray;
 import org.hornetq.utils.json.JSONObject;
 

Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,7 +27,7 @@
 import org.hornetq.core.client.impl.LargeMessageBufferInternal;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.BodyEncoder;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.utils.DataConstants;
 import org.hornetq.utils.TypedProperties;
 
@@ -48,10 +48,12 @@
 public abstract class MessageImpl implements MessageInternal
 {
    // Constants -----------------------------------------------------
-
+     
    private static final Logger log = Logger.getLogger(MessageImpl.class);
 
    public static final SimpleString HDR_ROUTE_TO_IDS = new SimpleString("_HQ_ROUTE_TO");
+   
+   public static final int BUFFER_HEADER_SPACE = PacketImpl.PACKET_HEADERS_SIZE;
 
    protected long messageID;
 
@@ -165,7 +167,7 @@
 
       int bodyPos = endOfBodyPosition == -1 ? buffer.writerIndex() : endOfBodyPosition;
 
-      int bodySize = bodyPos - PacketImpl.PACKET_HEADERS_SIZE - DataConstants.SIZE_INT;
+      int bodySize = bodyPos - BUFFER_HEADER_SPACE - DataConstants.SIZE_INT;
 
       return DataConstants.SIZE_INT + bodySize + DataConstants.SIZE_INT + headersPropsSize;
    }
@@ -212,7 +214,7 @@
       {
          if (buffer instanceof LargeMessageBufferInternal == false)
          {
-            bodyBuffer = new ResetLimitWrappedHornetQBuffer(PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT,
+            bodyBuffer = new ResetLimitWrappedHornetQBuffer(BUFFER_HEADER_SPACE + DataConstants.SIZE_INT,
                                                             buffer,
                                                             this);
          }
@@ -386,7 +388,7 @@
    {
       encodeToBuffer();
 
-      buff.writeBytes(buffer, PacketImpl.PACKET_HEADERS_SIZE, endOfMessagePosition - PacketImpl.PACKET_HEADERS_SIZE);
+      buff.writeBytes(buffer, BUFFER_HEADER_SPACE, endOfMessagePosition - BUFFER_HEADER_SPACE);
    }
 
    // Decode from journal or paging
@@ -396,11 +398,11 @@
 
       endOfBodyPosition = buff.readInt();
 
-      endOfMessagePosition = buff.getInt(endOfBodyPosition - PacketImpl.PACKET_HEADERS_SIZE + start);
+      endOfMessagePosition = buff.getInt(endOfBodyPosition - BUFFER_HEADER_SPACE + start);
 
-      int length = endOfMessagePosition - PacketImpl.PACKET_HEADERS_SIZE;
+      int length = endOfMessagePosition - BUFFER_HEADER_SPACE;
 
-      buffer.setIndex(0, PacketImpl.PACKET_HEADERS_SIZE);
+      buffer.setIndex(0, BUFFER_HEADER_SPACE);
 
       buffer.writeBytes(buff, start, length);
 
@@ -818,7 +820,7 @@
          }
 
          // write it
-         buffer.setInt(PacketImpl.PACKET_HEADERS_SIZE, endOfBodyPosition);
+         buffer.setInt(BUFFER_HEADER_SPACE, endOfBodyPosition);
 
          // Position at end of body and skip past the message end position int.
          // check for enough room in the buffer even tho it is dynamic
@@ -848,7 +850,7 @@
 
    private void decode()
    {
-      endOfBodyPosition = buffer.getInt(PacketImpl.PACKET_HEADERS_SIZE);
+      endOfBodyPosition = buffer.getInt(BUFFER_HEADER_SPACE);
 
       buffer.readerIndex(endOfBodyPosition + DataConstants.SIZE_INT);
 
@@ -866,7 +868,7 @@
       // There's a bug in netty which means a dynamic buffer won't resize until you write a byte
       buffer.writeByte((byte)0);
 
-      int limit = PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT;
+      int limit = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT;
 
       buffer.setIndex(limit, limit);
    }

Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -55,7 +55,6 @@
 import org.hornetq.core.persistence.StorageManager;
 import org.hornetq.core.postoffice.Binding;
 import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.protocol.core.wireformat.XidCodecSupport;
 import org.hornetq.core.replication.ReplicationManager;
 import org.hornetq.core.replication.impl.ReplicatedJournal;
 import org.hornetq.core.server.JournalType;
@@ -74,6 +73,7 @@
 import org.hornetq.utils.DataConstants;
 import org.hornetq.utils.ExecutorFactory;
 import org.hornetq.utils.UUID;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * 

Deleted: trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,508 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.protocol.core;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.remoting.RemotingConnection;
-
-/**
- * A ChannelImpl
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- */
-public class ChannelImpl implements Channel
-{
-   private static final Logger log = Logger.getLogger(ChannelImpl.class);
-
-   private volatile long id;
-
-   private ChannelHandler handler;
-
-   private Packet response;
-
-   private final java.util.Queue<Packet> resendCache;
-
-   private volatile int firstStoredCommandID;
-
-   private volatile int lastConfirmedCommandID = -1;
-
-   private volatile CoreRemotingConnection connection;
-
-   private volatile boolean closed;
-
-   private final Lock lock = new ReentrantLock();
-
-   private final Condition sendCondition = lock.newCondition();
-
-   private final Condition failoverCondition = lock.newCondition();
-
-   private final Object sendLock = new Object();
-
-   private final Object sendBlockingLock = new Object();
-
-   private boolean failingOver;
-
-   private final int confWindowSize;
-
-   private int receivedBytes;
-
-   private CommandConfirmationHandler commandConfirmationHandler;
-      
-   private volatile boolean transferring;
- 
-   public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
-   {
-      this.connection = connection;
-
-      this.id = id;
-
-      this.confWindowSize = confWindowSize;
-
-      if (confWindowSize != -1)
-      {
-         resendCache = new ConcurrentLinkedQueue<Packet>();
-      }
-      else
-      {
-         resendCache = null;
-      }
-   }
-
-   public long getID()
-   {
-      return id;
-   }
-
-   public int getLastConfirmedCommandID()
-   {
-      return lastConfirmedCommandID;
-   }
-
-   public Lock getLock()
-   {
-      return lock;
-   }
-
-   public int getConfirmationWindowSize()
-   {
-      return confWindowSize;
-   }
-
-   public void returnBlocking()
-   {
-      lock.lock();
-
-      try
-      {
-         response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
-                                                                     "Connection failure detected. Unblocking a blocking call that will never get a response"
-
-         ));
-
-         sendCondition.signal();
-      }
-      finally
-      {
-         lock.unlock();
-      }
-   }
-
-   public void sendAndFlush(final Packet packet)
-   {
-      send(packet, true);
-   }
-
-   public void send(final Packet packet)
-   {
-      send(packet, false);
-   }
-   
-   public void setTransferring(boolean transferring)
-   {
-      this.transferring = transferring;
-   }
-
-   // This must never called by more than one thread concurrently
-   public void send(final Packet packet, final boolean flush)
-   {
-      synchronized (sendLock)
-      {
-         packet.setChannelID(id);
-         
-         final HornetQBuffer buffer = packet.encode(connection);
-
-         lock.lock();
-                  
-         try
-         {
-            while (failingOver)
-            {
-               // TODO - don't hardcode this timeout
-               try
-               {
-                  failoverCondition.await(10000, TimeUnit.MILLISECONDS);
-               }
-               catch (InterruptedException e)
-               {
-               }
-            }
-            
-            //Sanity check
-            if (transferring)
-            {
-               throw new IllegalStateException("Cannot send a packet while channel is doing failover");
-            }
-            
-
-            if (resendCache != null && packet.isRequiresConfirmations())
-            {
-               resendCache.add(packet);
-            }
-
-            connection.getTransportConnection().write(buffer, flush);
-         }
-         finally
-         {
-            lock.unlock();
-         }
-      }
-   }
-
-   public Packet sendBlocking(final Packet packet) throws HornetQException
-   {
-      if (closed)
-      {
-         throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
-      }
-
-      if (connection.getBlockingCallTimeout() == -1)
-      {
-         throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
-      }
-
-      // Synchronized since can't be called concurrently by more than one thread and this can occur
-      // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
-      synchronized (sendBlockingLock)
-      {
-         packet.setChannelID(id);
-         
-         final HornetQBuffer buffer = packet.encode(connection);
-
-         lock.lock();
-
-         try
-         {
-            while (failingOver)
-            {
-               // TODO - don't hardcode this timeout
-               try
-               {
-                  failoverCondition.await(10000, TimeUnit.MILLISECONDS);
-               }
-               catch (InterruptedException e)
-               {
-               }
-            }
-
-            response = null;
-
-            if (resendCache != null && packet.isRequiresConfirmations())
-            {
-               resendCache.add(packet);
-            }
-
-            connection.getTransportConnection().write(buffer);
-
-            long toWait = connection.getBlockingCallTimeout();
-
-            long start = System.currentTimeMillis();
-
-            while (response == null && toWait > 0)
-            {
-               try
-               {
-                  sendCondition.await(toWait, TimeUnit.MILLISECONDS);
-               }
-               catch (InterruptedException e)
-               {
-               }
-
-               if (closed)
-               {
-                  break;
-               }
-
-               final long now = System.currentTimeMillis();
-
-               toWait -= now - start;
-
-               start = now;
-            }
-
-            if (response == null)
-            {
-               throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
-                                          "Timed out waiting for response when sending packet " + packet.getType());
-            }
-
-            if (response.getType() == PacketImpl.EXCEPTION)
-            {
-               final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
-
-               HornetQException e = mem.getException();
-
-               e.fillInStackTrace();
-
-               throw e;
-            }
-         }
-         finally
-         {
-            lock.unlock();
-         }
-
-         return response;
-      }
-   }
-
-   public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
-   {
-      commandConfirmationHandler = handler;
-   }
-
-   public void setHandler(final ChannelHandler handler)
-   {
-      this.handler = handler;
-   }
-
-   public void close()
-   {
-      if (closed)
-      {
-         return;
-      }
-
-      if (!connection.isDestroyed() && !connection.removeChannel(id))
-      {
-         throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
-      }
-
-      closed = true;
-   }
-   
-   public void transferConnection(final CoreRemotingConnection newConnection)
-   {
-      // Needs to synchronize on the connection to make sure no packets from
-      // the old connection get processed after transfer has occurred
-      synchronized (connection.getTransferLock())
-      {
-         connection.removeChannel(id);
-
-         // And switch it
-
-         final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
-
-         rnewConnection.putChannel(id, this);
-
-         connection = rnewConnection;
-
-         transferring = true;
-      }
-   }
-
-   public void replayCommands(final int otherLastConfirmedCommandID)
-   {
-      if (resendCache != null)
-      {
-         clearUpTo(otherLastConfirmedCommandID);
-
-         for (final Packet packet : resendCache)
-         {
-            doWrite(packet);
-         }
-      }
-   }
-
-   public void lock()
-   {
-      lock.lock();
-
-      failingOver = true;
-
-      lock.unlock();
-   }
-
-   public void unlock()
-   {
-      lock.lock();
-
-      failingOver = false;
-
-      failoverCondition.signalAll();
-
-      lock.unlock();
-   }
-
-   public CoreRemotingConnection getConnection()
-   {
-      return connection;
-   }
-   
-   //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
-   public synchronized void flushConfirmations()
-   {
-      if (resendCache != null && receivedBytes != 0)
-      {
-         receivedBytes = 0;
-
-         final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
-         confirmed.setChannelID(id);
-
-         doWrite(confirmed);
-      }
-   }
-
-   public void confirm(final Packet packet)
-   {
-      if (resendCache != null && packet.isRequiresConfirmations())
-      {
-         lastConfirmedCommandID++;
-
-         receivedBytes += packet.getPacketSize();
-
-         if (receivedBytes >= confWindowSize)
-         {
-            receivedBytes = 0;
-
-            final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
-            confirmed.setChannelID(id);
-
-            doWrite(confirmed);
-         }
-      }
-   }
-
-   public void clearCommands()
-   {
-      if (resendCache != null)
-      {
-         lastConfirmedCommandID = -1;
-
-         firstStoredCommandID = 0;
-
-         resendCache.clear();
-      }
-   }
-   
-   public void handlePacket(final Packet packet)
-   {
-      if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
-      {
-         if (resendCache != null)
-         {
-            final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
-
-            clearUpTo(msg.getCommandID());
-         }
-
-         if (!connection.isClient())
-         {
-            handler.handlePacket(packet);
-         }
-
-         return;
-      }
-      else
-      {
-         if (packet.isResponse())
-         {
-            confirm(packet);
-
-            lock.lock();
-
-            response = packet;
-
-            try
-            {
-               sendCondition.signal();
-            }
-            finally
-            {
-               lock.unlock();
-            }
-         }
-         else if (handler != null)
-         {
-            handler.handlePacket(packet);
-         }
-      }
-   }
-
-   private void doWrite(final Packet packet)
-   {
-      final HornetQBuffer buffer = packet.encode(connection);
-
-      connection.getTransportConnection().write(buffer);
-   }
-
-   private void clearUpTo(final int lastReceivedCommandID)
-   {
-      final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
-
-      if (numberToClear == -1)
-      {
-         throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
-      }
-
-      int sizeToFree = 0;
-
-      for (int i = 0; i < numberToClear; i++)
-      {
-         final Packet packet = resendCache.poll();
-
-         if (packet == null)
-         {
-            ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
-                                 lastReceivedCommandID +
-                                 " first stored command id " +
-                                 firstStoredCommandID);
-            return;
-         }
-
-         if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
-         {
-            sizeToFree += packet.getPacketSize();
-         }
-
-         if (commandConfirmationHandler != null)
-         {
-            commandConfirmationHandler.commandConfirmed(packet);
-         }
-      }
-
-      firstStoredCommandID += numberToClear;
-   }
-}

Deleted: trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,116 +0,0 @@
-/*
- * Copyright 2010 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.hornetq.core.protocol.core;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.protocol.core.wireformat.Ping;
-import org.hornetq.core.remoting.server.ConnectionEntry;
-import org.hornetq.core.remoting.server.ProtocolManager;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A CoreProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public class CoreProtocolManager implements ProtocolManager
-{
-   private final HornetQServer server;
-   
-   private final List<Interceptor> interceptors;
-
-   public CoreProtocolManager(final HornetQServer server,
-                              final List<Interceptor> interceptors)
-   {
-      this.server = server;
-
-      this.interceptors = interceptors;
-   }
-
-   public ConnectionEntry createConnectionEntry(final Connection connection)
-   {
-      final Configuration config = server.getConfiguration();
-      
-      CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
-                                                             interceptors,
-                                                             config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
-                                                                                                       : null);
-
-      Channel channel1 = rc.getChannel(1, -1);
-
-      ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
-
-      channel1.setHandler(handler);
-
-      long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
-
-      if (config.getConnectionTTLOverride() != -1)
-      {
-         ttl = config.getConnectionTTLOverride();
-      }
-
-      final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
-
-      final Channel channel0 = rc.getChannel(0, -1);
-
-      channel0.setHandler(new ChannelHandler()
-      {
-         public void handlePacket(final Packet packet)
-         {
-            if (packet.getType() == PacketImpl.PING)
-            {
-               Ping ping = (Ping)packet;
-
-               if (config.getConnectionTTLOverride() == -1)
-               {
-                  // Allow clients to specify connection ttl
-                  entry.ttl = ping.getConnectionTTL();
-               }
-
-               // Just send a ping back
-               channel0.send(packet);
-            }
-         }
-      });
-
-      return entry;
-   }
-   
-   private Map<String, ServerSessionPacketHandler> sessionHandlers = 
-      new ConcurrentHashMap<String, ServerSessionPacketHandler>();
-   
-   public ServerSessionPacketHandler getSessionHandler(final String sessionName)
-   {
-      return sessionHandlers.get(sessionName);
-   }
-   
-   public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
-   {
-      sessionHandlers.put(name, handler);
-   }
-   
-   public void removeHandler(final String name)
-   {
-      sessionHandlers.remove(name);
-   }
-}

Modified: trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,7 +13,7 @@
 
 package org.hornetq.core.protocol.core;
 
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 
 /**

Deleted: trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,310 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.protocol.core;
-
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION;
-
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.replication.ReplicationEndpoint;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.version.Version;
-
-/**
- * A packet handler for all packets that need to be handled at the server level
- * 
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class HornetQPacketHandler implements ChannelHandler
-{
-   private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
-
-   private final HornetQServer server;
-
-   private final Channel channel1;
-
-   private final CoreRemotingConnection connection;
-
-   private final CoreProtocolManager protocolManager;
-
-   public HornetQPacketHandler(final CoreProtocolManager protocolManager,
-                               final HornetQServer server,
-                               final Channel channel1,
-                               final CoreRemotingConnection connection)
-   {
-      this.protocolManager = protocolManager;
-
-      this.server = server;
-
-      this.channel1 = channel1;
-
-      this.connection = connection;
-   }
-
-   public void handlePacket(final Packet packet)
-   {
-      byte type = packet.getType();
-
-      switch (type)
-      {
-         case CREATESESSION:
-         {
-            CreateSessionMessage request = (CreateSessionMessage)packet;
-
-            handleCreateSession(request);
-
-            break;
-         }
-         case REATTACH_SESSION:
-         {
-            ReattachSessionMessage request = (ReattachSessionMessage)packet;
-
-            handleReattachSession(request);
-
-            break;
-         }
-         case CREATE_QUEUE:
-         {
-            // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
-            CreateQueueMessage request = (CreateQueueMessage)packet;
-
-            handleCreateQueue(request);
-
-            break;
-         }
-         case CREATE_REPLICATION:
-         {
-            // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
-            CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
-
-            handleCreateReplication(request);
-
-            break;
-         }
-         default:
-         {
-            HornetQPacketHandler.log.error("Invalid packet " + packet);
-         }
-      }
-   }
-
-   private void handleCreateSession(final CreateSessionMessage request)
-   {
-      boolean incompatibleVersion = false;
-      Packet response;
-      try
-      {
-         Version version = server.getVersion();
-
-         if (version.getIncrementingVersion() != request.getVersion())
-         {
-            log.warn("Client with version " + request.getVersion() +
-                     " and address " +
-                     connection.getRemoteAddress() +
-                     " is not compatible with server version " +
-                     version.getFullVersion() +
-                     ". " +
-                     "Please ensure all clients and servers are upgraded to the same version for them to " +
-                     "interoperate properly");
-            throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
-                                       "Server and client versions incompatible");
-         }
-
-         if (!server.isStarted())
-         {
-            throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
-         }
-
-         if (!server.checkActivate())
-         {
-            throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
-                                       "Server will not accept create session requests");
-         }
-
-         Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
-
-         ServerSession session = server.createSession(request.getName(),                                                      
-                                                      request.getUsername(),
-                                                      request.getPassword(),
-                                                      request.getMinLargeMessageSize(),                                                    
-                                                      connection,
-                                                      request.isAutoCommitSends(),
-                                                      request.isAutoCommitAcks(),
-                                                      request.isPreAcknowledge(),
-                                                      request.isXA());
-
-         ServerSessionPacketHandler handler = new ServerSessionPacketHandler(protocolManager,
-                                                                             session,
-                                                                             server.getStorageManager()
-                                                                                   .newContext(server.getExecutorFactory()
-                                                                                                     .getExecutor()),
-                                                                             server.getStorageManager(),
-                                                                             channel);
-
-         session.setCallback(handler);
-
-         channel.setHandler(handler);
-
-         // TODO - where is this removed?
-         protocolManager.addSessionHandler(request.getName(), handler);
-
-         response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
-      }
-      catch (HornetQException e)
-      {
-         response = new HornetQExceptionMessage((HornetQException)e);
-
-         if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
-         {
-            incompatibleVersion = true;
-         }
-      }
-      catch (Exception e)
-      {
-         HornetQPacketHandler.log.error("Failed to create session", e);
-         
-         response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
-      }
-
-      // send the exception to the client and destroy
-      // the connection if the client and server versions
-      // are not compatible
-      if (incompatibleVersion)
-      {
-         channel1.sendAndFlush(response);
-      }
-      else
-      {
-         channel1.send(response);
-      }
-   }
-
-   private void handleReattachSession(final ReattachSessionMessage request)
-   {
-      Packet response = null;
-      
-      try
-      {
-   
-         if (!server.isStarted())
-         {
-            response = new ReattachSessionResponseMessage(-1, false);
-         }
-   
-         ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
-         
-         if (!server.checkActivate())
-         {
-            response = new ReattachSessionResponseMessage(-1, false);
-         }
-   
-         if (sessionHandler == null)
-         {
-            response = new ReattachSessionResponseMessage(-1, false);
-         }
-         else
-         {
-            if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
-            {
-               // Even though session exists, we can't reattach since confi window size == -1,
-               // i.e. we don't have a resend cache for commands, so we just close the old session
-               // and let the client recreate
-   
-               sessionHandler.close();
-   
-               response = new ReattachSessionResponseMessage(-1, false);
-            }
-            else
-            {
-               // Reconnect the channel to the new connection
-               int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
-                                                                                    request.getLastConfirmedCommandID());
-   
-               response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         HornetQPacketHandler.log.error("Failed to reattach session", e);
-         
-         response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
-      }
-
-      channel1.send(response);
-   }
-
-   private void handleCreateQueue(final CreateQueueMessage request)
-   {
-      try
-      {
-         server.createQueue(request.getAddress(),
-                            request.getQueueName(),
-                            request.getFilterString(),
-                            request.isDurable(),
-                            request.isTemporary());
-      }
-      catch (Exception e)
-      {
-         HornetQPacketHandler.log.error("Failed to handle create queue", e);
-      }
-   }
-
-   private void handleCreateReplication(final CreateReplicationSessionMessage request)
-   {
-      Packet response;
-
-      try
-      {
-         Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
-
-         ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
-
-         channel.setHandler(endpoint);
-
-         response = new NullResponseMessage();
-      }
-      catch (Exception e)
-      {
-         if (e instanceof HornetQException)
-         {
-            response = new HornetQExceptionMessage((HornetQException)e);
-         }
-         else
-         {
-            HornetQPacketHandler.log.warn(e.getMessage(), e);
-            response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
-         }
-      }
-
-      channel1.send(response);
-   }
-
-}
\ No newline at end of file

Modified: trunk/src/main/org/hornetq/core/protocol/core/Packet.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/Packet.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/Packet.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -14,7 +14,7 @@
 package org.hornetq.core.protocol.core;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A Packet represents a pcaket of data transmitted over a connection.

Deleted: trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,492 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.protocol.core;
-
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.DISCONNECT;
-import static org.hornetq.core.protocol.core.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.PacketImpl.NULL_RESPONSE;
-import static org.hornetq.core.protocol.core.PacketImpl.PACKETS_CONFIRMED;
-import static org.hornetq.core.protocol.core.PacketImpl.PING;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_APPEND;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_APPEND_TX;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_COMPARE_DATA;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_DELETE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_DELETE_TX;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PAGE_EVENT;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PAGE_WRITE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_RESPONSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_PRODUCER_CREDITS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SUSPEND;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.protocol.core.wireformat.Ping;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
-
-/**
- * A PacketDecoder
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- *
- */
-public class PacketDecoder
-{
-   private static final Logger log = Logger.getLogger(PacketDecoder.class);
-
-   public Packet decode(final HornetQBuffer in)
-   {
-      final byte packetType = in.readByte();
-
-      Packet packet;
-
-      switch (packetType)
-      {
-         case PING:
-         {
-            packet = new Ping();
-            break;
-         }
-         case DISCONNECT:
-         {
-            packet = new PacketImpl(PacketImpl.DISCONNECT);
-            break;
-         }
-         case EXCEPTION:
-         {
-            packet = new HornetQExceptionMessage();
-            break;
-         }
-         case PACKETS_CONFIRMED:
-         {
-            packet = new PacketsConfirmedMessage();
-            break;
-         }
-         case CREATESESSION:
-         {
-            packet = new CreateSessionMessage();
-            break;
-         }
-         case CREATESESSION_RESP:
-         {
-            packet = new CreateSessionResponseMessage();
-            break;
-         }
-         case REATTACH_SESSION:
-         {
-            packet = new ReattachSessionMessage();
-            break;
-         }
-         case REATTACH_SESSION_RESP:
-         {
-            packet = new ReattachSessionResponseMessage();
-            break;
-         }
-         case SESS_CLOSE:
-         {
-            packet = new SessionCloseMessage();
-            break;
-         }
-         case SESS_CREATECONSUMER:
-         {
-            packet = new SessionCreateConsumerMessage();
-            break;
-         }
-         case SESS_ACKNOWLEDGE:
-         {
-            packet = new SessionAcknowledgeMessage();
-            break;
-         }
-         case SESS_EXPIRED:
-         {
-            packet = new SessionExpiredMessage();
-            break;
-         }
-         case SESS_COMMIT:
-         {
-            packet = new SessionCommitMessage();
-            break;
-         }
-         case SESS_ROLLBACK:
-         {
-            packet = new RollbackMessage();
-            break;
-         }
-         case SESS_QUEUEQUERY:
-         {
-            packet = new SessionQueueQueryMessage();
-            break;
-         }
-         case SESS_QUEUEQUERY_RESP:
-         {
-            packet = new SessionQueueQueryResponseMessage();
-            break;
-         }
-         case CREATE_QUEUE:
-         {
-            packet = new CreateQueueMessage();
-            break;
-         }
-         case DELETE_QUEUE:
-         {
-            packet = new SessionDeleteQueueMessage();
-            break;
-         }
-         case SESS_BINDINGQUERY:
-         {
-            packet = new SessionBindingQueryMessage();
-            break;
-         }
-         case SESS_BINDINGQUERY_RESP:
-         {
-            packet = new SessionBindingQueryResponseMessage();
-            break;
-         }
-         case SESS_XA_START:
-         {
-            packet = new SessionXAStartMessage();
-            break;
-         }
-         case SESS_XA_END:
-         {
-            packet = new SessionXAEndMessage();
-            break;
-         }
-         case SESS_XA_COMMIT:
-         {
-            packet = new SessionXACommitMessage();
-            break;
-         }
-         case SESS_XA_PREPARE:
-         {
-            packet = new SessionXAPrepareMessage();
-            break;
-         }
-         case SESS_XA_RESP:
-         {
-            packet = new SessionXAResponseMessage();
-            break;
-         }
-         case SESS_XA_ROLLBACK:
-         {
-            packet = new SessionXARollbackMessage();
-            break;
-         }
-         case SESS_XA_JOIN:
-         {
-            packet = new SessionXAJoinMessage();
-            break;
-         }
-         case SESS_XA_SUSPEND:
-         {
-            packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
-            break;
-         }
-         case SESS_XA_RESUME:
-         {
-            packet = new SessionXAResumeMessage();
-            break;
-         }
-         case SESS_XA_FORGET:
-         {
-            packet = new SessionXAForgetMessage();
-            break;
-         }
-         case SESS_XA_INDOUBT_XIDS:
-         {
-            packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
-            break;
-         }
-         case SESS_XA_INDOUBT_XIDS_RESP:
-         {
-            packet = new SessionXAGetInDoubtXidsResponseMessage();
-            break;
-         }
-         case SESS_XA_SET_TIMEOUT:
-         {
-            packet = new SessionXASetTimeoutMessage();
-            break;
-         }
-         case SESS_XA_SET_TIMEOUT_RESP:
-         {
-            packet = new SessionXASetTimeoutResponseMessage();
-            break;
-         }
-         case SESS_XA_GET_TIMEOUT:
-         {
-            packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
-            break;
-         }
-         case SESS_XA_GET_TIMEOUT_RESP:
-         {
-            packet = new SessionXAGetTimeoutResponseMessage();
-            break;
-         }
-         case SESS_START:
-         {
-            packet = new PacketImpl(PacketImpl.SESS_START);
-            break;
-         }
-         case SESS_STOP:
-         {
-            packet = new PacketImpl(PacketImpl.SESS_STOP);
-            break;
-         }
-         case SESS_FLOWTOKEN:
-         {
-            packet = new SessionConsumerFlowCreditMessage();
-            break;
-         }
-         case SESS_SEND:
-         {
-            packet = new SessionSendMessage();
-            break;
-         }
-         case SESS_SEND_LARGE:
-         {
-            packet = new SessionSendLargeMessage();
-            break;
-         }
-         case SESS_RECEIVE_MSG:
-         {
-            packet = new SessionReceiveMessage();
-            break;
-         }
-         case SESS_RECEIVE_LARGE_MSG:
-         {
-            packet = new SessionReceiveLargeMessage();
-            break;
-         }
-         case SESS_CONSUMER_CLOSE:
-         {
-            packet = new SessionConsumerCloseMessage();
-            break;
-         }
-         case NULL_RESPONSE:
-         {
-            packet = new NullResponseMessage();
-            break;
-         }
-         case SESS_RECEIVE_CONTINUATION:
-         {
-            packet = new SessionReceiveContinuationMessage();
-            break;
-         }
-         case SESS_SEND_CONTINUATION:
-         {
-            packet = new SessionSendContinuationMessage();
-            break;
-         }
-         case SESS_PRODUCER_REQUEST_CREDITS:
-         {
-            packet = new SessionRequestProducerCreditsMessage();
-            break;
-         }
-         case SESS_PRODUCER_CREDITS:
-         {
-            packet = new SessionProducerCreditsMessage();
-            break;
-         }
-         case CREATE_REPLICATION:
-         {
-            packet = new CreateReplicationSessionMessage();
-            break;
-         }
-         case REPLICATION_APPEND:
-         {
-            packet = new ReplicationAddMessage();
-            break;
-         }
-         case REPLICATION_APPEND_TX:
-         {
-            packet = new ReplicationAddTXMessage();
-            break;
-         }
-         case REPLICATION_DELETE:
-         {
-            packet = new ReplicationDeleteMessage();
-            break;
-         }
-         case REPLICATION_DELETE_TX:
-         {
-            packet = new ReplicationDeleteTXMessage();
-            break;
-         }
-         case REPLICATION_PREPARE:
-         {
-            packet = new ReplicationPrepareMessage();
-            break;
-         }
-         case REPLICATION_COMMIT_ROLLBACK:
-         {
-            packet = new ReplicationCommitMessage();
-            break;
-         }
-         case REPLICATION_RESPONSE:
-         {
-            packet = new ReplicationResponseMessage();
-            break;
-         }
-         case REPLICATION_PAGE_WRITE:
-         {
-            packet = new ReplicationPageWriteMessage();
-            break;
-         }
-         case REPLICATION_PAGE_EVENT:
-         {
-            packet = new ReplicationPageEventMessage();
-            break;
-         }
-         case REPLICATION_LARGE_MESSAGE_BEGIN:
-         {
-            packet = new ReplicationLargeMessageBeingMessage();
-            break;
-         }
-         case REPLICATION_LARGE_MESSAGE_END:
-         {
-            packet = new ReplicationLargemessageEndMessage();
-            break;
-         }
-         case REPLICATION_LARGE_MESSAGE_WRITE:
-         {
-            packet = new ReplicationLargeMessageWriteMessage();
-            break;
-         }
-         case REPLICATION_COMPARE_DATA:
-         {
-            packet = new ReplicationCompareDataMessage();
-            break;
-         }
-         case SESS_FORCE_CONSUMER_DELIVERY:
-         {
-            packet = new SessionForceConsumerDelivery();
-            break;
-         }
-         default:
-         {
-            throw new IllegalArgumentException("Invalid type: " + packetType);
-         }
-      }
-
-      packet.decode(in);
-
-      return packet;
-   }
-
-}

Deleted: trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,310 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.protocol.core;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class PacketImpl implements Packet
-{
-   // Constants -------------------------------------------------------------------------
-
-   private static final Logger log = Logger.getLogger(PacketImpl.class);
-
-   // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
-   public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
-                                                 DataConstants.SIZE_LONG;
-
-   private static final int INITIAL_PACKET_SIZE = 1500;
-
-   protected long channelID;
-
-   protected final byte type;
-
-   protected int size = -1;
-
-   // The packet types
-   // -----------------------------------------------------------------------------------
-
-   public static final byte PING = 10;
-
-   public static final byte DISCONNECT = 11;
-
-   // Miscellaneous
-   public static final byte EXCEPTION = 20;
-
-   public static final byte NULL_RESPONSE = 21;
-
-   public static final byte PACKETS_CONFIRMED = 22;
-
-   // Server
-   public static final byte CREATESESSION = 30;
-
-   public static final byte CREATESESSION_RESP = 31;
-
-   public static final byte REATTACH_SESSION = 32;
-
-   public static final byte REATTACH_SESSION_RESP = 33;
-
-   public static final byte CREATE_QUEUE = 34;
-
-   public static final byte DELETE_QUEUE = 35;
-
-   public static final byte CREATE_REPLICATION = 36;
-
-   // Session
-   public static final byte SESS_CREATECONSUMER = 40;
-
-   public static final byte SESS_ACKNOWLEDGE = 41;
-
-   public static final byte SESS_EXPIRED = 42;
-
-   public static final byte SESS_COMMIT = 43;
-
-   public static final byte SESS_ROLLBACK = 44;
-
-   public static final byte SESS_QUEUEQUERY = 45;
-
-   public static final byte SESS_QUEUEQUERY_RESP = 46;
-
-   public static final byte SESS_BINDINGQUERY = 49;
-
-   public static final byte SESS_BINDINGQUERY_RESP = 50;
-
-   public static final byte SESS_XA_START = 51;
-
-   public static final byte SESS_XA_END = 52;
-
-   public static final byte SESS_XA_COMMIT = 53;
-
-   public static final byte SESS_XA_PREPARE = 54;
-
-   public static final byte SESS_XA_RESP = 55;
-
-   public static final byte SESS_XA_ROLLBACK = 56;
-
-   public static final byte SESS_XA_JOIN = 57;
-
-   public static final byte SESS_XA_SUSPEND = 58;
-
-   public static final byte SESS_XA_RESUME = 59;
-
-   public static final byte SESS_XA_FORGET = 60;
-
-   public static final byte SESS_XA_INDOUBT_XIDS = 61;
-
-   public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
-
-   public static final byte SESS_XA_SET_TIMEOUT = 63;
-
-   public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
-
-   public static final byte SESS_XA_GET_TIMEOUT = 65;
-
-   public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
-
-   public static final byte SESS_START = 67;
-
-   public static final byte SESS_STOP = 68;
-
-   public static final byte SESS_CLOSE = 69;
-
-   public static final byte SESS_FLOWTOKEN = 70;
-
-   public static final byte SESS_SEND = 71;
-
-   public static final byte SESS_SEND_LARGE = 72;
-
-   public static final byte SESS_SEND_CONTINUATION = 73;
-
-   public static final byte SESS_CONSUMER_CLOSE = 74;
-
-   public static final byte SESS_RECEIVE_MSG = 75;
-
-   public static final byte SESS_RECEIVE_LARGE_MSG = 76;
-
-   public static final byte SESS_RECEIVE_CONTINUATION = 77;
-
-   public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
-
-   public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
-
-   public static final byte SESS_PRODUCER_CREDITS = 80;
-
-   // Replication
-
-   public static final byte REPLICATION_RESPONSE = 90;
-
-   public static final byte REPLICATION_APPEND = 91;
-
-   public static final byte REPLICATION_APPEND_TX = 92;
-
-   public static final byte REPLICATION_DELETE = 93;
-
-   public static final byte REPLICATION_DELETE_TX = 94;
-
-   public static final byte REPLICATION_PREPARE = 95;
-
-   public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
-
-   public static final byte REPLICATION_PAGE_WRITE = 97;
-
-   public static final byte REPLICATION_PAGE_EVENT = 98;
-
-   public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
-
-   public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
-
-   public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
-
-   public static final byte REPLICATION_COMPARE_DATA = 102;
-
-   public static final byte REPLICATION_SYNC = 103;
-
-   // Static --------------------------------------------------------
-
-   public PacketImpl(final byte type)
-   {
-      this.type = type;
-   }
-
-   // Public --------------------------------------------------------
-
-   public byte getType()
-   {
-      return type;
-   }
-
-   public long getChannelID()
-   {
-      return channelID;
-   }
-
-   public void setChannelID(final long channelID)
-   {
-      this.channelID = channelID;
-   }
-
-   public HornetQBuffer encode(final RemotingConnection connection)
-   {
-      HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
-
-      // The standard header fields
-
-      buffer.writeInt(0); // The length gets filled in at the end
-      buffer.writeByte(type);
-      buffer.writeLong(channelID);
-
-      encodeRest(buffer);
-
-      size = buffer.writerIndex();
-
-      // The length doesn't include the actual length byte
-      int len = size - DataConstants.SIZE_INT;
-
-      buffer.setInt(0, len);
-
-      return buffer;
-   }
-
-   public void decode(final HornetQBuffer buffer)
-   {
-      channelID = buffer.readLong();
-
-      decodeRest(buffer);
-
-      size = buffer.readerIndex();
-   }
-
-   public int getPacketSize()
-   {
-      if (size == -1)
-      {
-         throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
-      }
-
-      return size;
-   }
-
-   public boolean isResponse()
-   {
-      return false;
-   }
-
-   public void encodeRest(final HornetQBuffer buffer)
-   {
-   }
-
-   public void decodeRest(final HornetQBuffer buffer)
-   {
-   }
-
-   public boolean isRequiresConfirmations()
-   {
-      return true;
-   }
-   
-   public boolean isAsyncExec()
-   {
-      return false;
-   }
-
-   @Override
-   public String toString()
-   {
-      return getParentString() + "]";
-   }
-
-   @Override
-   public boolean equals(final Object other)
-   {
-      if (other instanceof PacketImpl == false)
-      {
-         return false;
-      }
-
-      PacketImpl r = (PacketImpl)other;
-
-      return r.type == type && r.channelID == channelID;
-   }
-
-   // Package protected ---------------------------------------------
-
-   protected String getParentString()
-   {
-      return "PACKET[type=" + type + ", channelID=" + channelID + "]";
-   }
-
-   // Protected -----------------------------------------------------
-
-   protected int stringEncodeSize(final String str)
-   {
-      return DataConstants.SIZE_INT + str.length() * 2;
-   }
-
-   protected int nullableStringEncodeSize(final String str)
-   {
-      return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
-   }
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-}

Deleted: trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,509 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.protocol.core;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-import org.hornetq.utils.SimpleIDGenerator;
-
-/**
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * @version <tt>$Revision$</tt> $Id$
- */
-public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
-{
-   // Constants
-   // ------------------------------------------------------------------------------------
-
-   private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
-
-   // Static
-   // ---------------------------------------------------------------------------------------
-
-   // Attributes
-   // -----------------------------------------------------------------------------------
-
-   private final Connection transportConnection;
-
-   private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
-
-   private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
-
-   private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
-
-   private final long blockingCallTimeout;
-
-   private final List<Interceptor> interceptors;
-
-   private volatile boolean destroyed;
-
-   private final boolean client;
-
-   // Channels 0-9 are reserved for the system
-   // 0 is for pinging
-   // 1 is for session creation and attachment
-   // 2 is for replication
-   private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
-
-   private boolean idGeneratorSynced = false;
-
-   private final Object transferLock = new Object();
-
-   private final Object failLock = new Object();
-
-   private final PacketDecoder decoder = new PacketDecoder();
-
-   private volatile boolean dataReceived;
-
-   private final Executor executor;
-   
-   private volatile boolean executing;
-
-   // Constructors
-   // ---------------------------------------------------------------------------------
-
-   /*
-    * Create a client side connection
-    */
-   public RemotingConnectionImpl(final Connection transportConnection,
-                                 final long blockingCallTimeout,
-                                 final List<Interceptor> interceptors)
-   {
-      this(transportConnection, blockingCallTimeout, interceptors, true, null);
-   }
-
-   /*
-    * Create a server side connection
-    */
-   public RemotingConnectionImpl(final Connection transportConnection,
-                                 final List<Interceptor> interceptors,
-                                 final Executor executor)
-
-   {
-      this(transportConnection, -1, interceptors, false, executor);
-   }
-
-   private RemotingConnectionImpl(final Connection transportConnection,
-                                  final long blockingCallTimeout,
-                                  final List<Interceptor> interceptors,
-                                  final boolean client,
-                                  final Executor executor)
-
-   {
-      this.transportConnection = transportConnection;
-
-      this.blockingCallTimeout = blockingCallTimeout;
-
-      this.interceptors = interceptors;
-
-      this.client = client;
-
-      this.executor = executor;
-   }
-
-   // RemotingConnection implementation
-   // ------------------------------------------------------------
-
-   public Connection getTransportConnection()
-   {
-      return transportConnection;
-   }
-
-   public List<FailureListener> getFailureListeners()
-   {
-      return new ArrayList<FailureListener>(failureListeners);
-   }
-
-   public void setFailureListeners(final List<FailureListener> listeners)
-   {
-      failureListeners.clear();
-
-      failureListeners.addAll(listeners);
-   }
-
-   public Object getID()
-   {
-      return transportConnection.getID();
-   }
-
-   public String getRemoteAddress()
-   {
-      return transportConnection.getRemoteAddress();
-   }
-
-   public synchronized Channel getChannel(final long channelID, final int confWindowSize)
-   {
-      Channel channel = channels.get(channelID);
-
-      if (channel == null)
-      {
-         channel = new ChannelImpl(this, channelID, confWindowSize);
-
-         channels.put(channelID, channel);
-      }
-
-      return channel;
-   }
-
-   public synchronized boolean removeChannel(final long channelID)
-   {
-      return channels.remove(channelID) != null;
-   }
-
-   public synchronized void putChannel(final long channelID, final Channel channel)
-   {
-      channels.put(channelID, channel);
-   }
-
-   public void addFailureListener(final FailureListener listener)
-   {
-      if (listener == null)
-      {
-         throw new IllegalStateException("FailureListener cannot be null");
-      }
-
-      failureListeners.add(listener);
-   }
-
-   public boolean removeFailureListener(final FailureListener listener)
-   {
-      if (listener == null)
-      {
-         throw new IllegalStateException("FailureListener cannot be null");
-      }
-
-      return failureListeners.remove(listener);
-   }
-
-   public void addCloseListener(final CloseListener listener)
-   {
-      if (listener == null)
-      {
-         throw new IllegalStateException("CloseListener cannot be null");
-      }
-
-      closeListeners.add(listener);
-   }
-
-   public boolean removeCloseListener(final CloseListener listener)
-   {
-      if (listener == null)
-      {
-         throw new IllegalStateException("CloseListener cannot be null");
-      }
-
-      return closeListeners.remove(listener);
-   }
-
-   public HornetQBuffer createBuffer(final int size)
-   {
-      return transportConnection.createBuffer(size);
-   }
-
-   /*
-    * This can be called concurrently by more than one thread so needs to be locked
-    */
-   public void fail(final HornetQException me)
-   {
-      synchronized (failLock)
-      {
-         if (destroyed)
-         {
-            return;
-         }
-
-         destroyed = true;
-      }
-
-      RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
-                                      " [code=" +
-                                      me.getCode() +
-                                      "]");
-
-      // Then call the listeners
-      callFailureListeners(me);
-
-      callClosingListeners();
-
-      internalClose();
-
-      for (Channel channel : channels.values())
-      {
-         channel.returnBlocking();
-      }
-   }
-
-   public void destroy()
-   {
-      synchronized (failLock)
-      {
-         if (destroyed)
-         {
-            return;
-         }
-
-         destroyed = true;
-      }
-
-      internalClose();
-
-      callClosingListeners();
-   }
-   
-   public void disconnect()
-   {
-      Channel channel0 = getChannel(0, -1);
-
-      // And we remove all channels from the connection, this ensures no more packets will be processed after this
-      // method is
-      // complete
-      
-      Set<Channel> allChannels = new HashSet<Channel>(channels.values());
-
-      removeAllChannels();
-
-      // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
-      
-      for (Channel channel: allChannels)
-      {
-         channel.flushConfirmations();
-      }
-
-      channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
-   }
-
-   public long generateChannelID()
-   {
-      return idGenerator.generateID();
-   }
-
-   public synchronized void syncIDGeneratorSequence(final long id)
-   {
-      if (!idGeneratorSynced)
-      {
-         idGenerator = new SimpleIDGenerator(id);
-
-         idGeneratorSynced = true;
-      }
-   }
-
-   public long getIDGeneratorSequence()
-   {
-      return idGenerator.getCurrentID();
-   }
-
-   public Object getTransferLock()
-   {
-      return transferLock;
-   }
-
-   public boolean isClient()
-   {
-      return client;
-   }
-
-   public boolean isDestroyed()
-   {
-      return destroyed;
-   }
-
-   public long getBlockingCallTimeout()
-   {
-      return blockingCallTimeout;
-   }
-
-   public boolean checkDataReceived()
-   {
-      boolean res = dataReceived;
-
-      dataReceived = false;
-
-      return res;
-   }
-
-   //We flush any confirmations on the connection - this prevents idle bridges for example
-   //sitting there with many unacked messages
-   public void flush()
-   {
-      synchronized (transferLock)
-      {
-         for (Channel channel : channels.values())
-         {
-            channel.flushConfirmations();
-         }
-      }
-   }
-
-   // Buffer Handler implementation
-   // ----------------------------------------------------
-
-   public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
-   {
-      final Packet packet = decoder.decode(buffer);
-
-      if (packet.isAsyncExec() && executor != null)
-      {
-         executing = true;
-
-         executor.execute(new Runnable()
-         {
-            public void run()
-            {
-               try
-               {
-                  doBufferReceived(packet);
-               }
-               catch (Throwable t)
-               {
-                  RemotingConnectionImpl.log.error("Unexpected error", t);
-               }
-
-               executing = false;
-            }
-         });
-      }
-      else
-      {
-         //To prevent out of order execution if interleaving sync and async operations on same connection
-         while (executing)
-         {
-            Thread.yield();
-         }
-         
-         // Pings must always be handled out of band so we can send pings back to the client quickly
-         // otherwise they would get in the queue with everything else which might give an intolerable delay
-         doBufferReceived(packet);
-      }
-     
-      dataReceived = true;
-   }
-
-   private void doBufferReceived(final Packet packet)
-   {
-      if (interceptors != null)
-      {
-         for (final Interceptor interceptor : interceptors)
-         {
-            try
-            {
-               boolean callNext = interceptor.intercept(packet, this);
-
-               if (!callNext)
-               {
-                  return;
-               }
-            }
-            catch (final Throwable e)
-            {
-               RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
-            }
-         }
-      }
-
-      synchronized (transferLock)
-      {
-         final Channel channel = channels.get(packet.getChannelID());
-
-         if (channel != null)
-         {
-            channel.handlePacket(packet);
-         }
-      }
-   }
-
-   // Package protected
-   // ----------------------------------------------------------------------------
-
-   // Protected
-   // ------------------------------------------------------------------------------------
-
-   // Private
-   // --------------------------------------------------------------------------------------
-
-   private void removeAllChannels()
-   {
-      // We get the transfer lock first - this ensures no packets are being processed AND
-      // it's guaranteed no more packets will be processed once this method is complete
-      synchronized (transferLock)
-      {
-         channels.clear();
-      }
-   }  
-   private void callFailureListeners(final HornetQException me)
-   {
-      final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
-
-      for (final FailureListener listener : listenersClone)
-      {
-         try
-         {
-            listener.connectionFailed(me);
-         }
-         catch (final Throwable t)
-         {
-            // Failure of one listener to execute shouldn't prevent others
-            // from
-            // executing
-            RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
-         }
-      }
-   }
-
-   private void callClosingListeners()
-   {
-      final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
-
-      for (final CloseListener listener : listenersClone)
-      {
-         try
-         {
-            listener.connectionClosed();
-         }
-         catch (final Throwable t)
-         {
-            // Failure of one listener to execute shouldn't prevent others
-            // from
-            // executing
-            RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
-         }
-      }
-   }
-
-   private void internalClose()
-   {
-      // We close the underlying transport connection
-      transportConnection.close();
-
-      for (Channel channel : channels.values())
-      {
-         channel.close();
-      }
-   }
-}

Modified: trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,36 +13,36 @@
 
 package org.hornetq.core.protocol.core;
 
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SUSPEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
 
 import java.util.List;
 
@@ -56,49 +56,51 @@
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.persistence.OperationContext;
 import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
+import org.hornetq.core.protocol.core.impl.CoreProtocolManager;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
 import org.hornetq.core.remoting.CloseListener;
 import org.hornetq.core.remoting.FailureListener;
 import org.hornetq.core.server.BindingQueryResult;
 import org.hornetq.core.server.QueueQueryResult;
 import org.hornetq.core.server.ServerMessage;
 import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
+import org.hornetq.spi.core.protocol.SessionCallback;
 
 /**
  * A ServerSessionPacketHandler

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2009 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.hornetq.core.protocol.core.impl;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A AbstractBufferHandler
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public abstract class AbstractBufferHandler implements BufferHandler
+{
+   private static final Logger log = Logger.getLogger(AbstractBufferHandler.class);
+
+   public int isReadyToHandle(final HornetQBuffer buffer)
+   {
+      if (buffer.readableBytes() < DataConstants.SIZE_INT)
+      {
+         return -1;
+      }
+
+      int length = buffer.readInt();
+
+      if (buffer.readableBytes() < length)
+      {
+         return -1;
+      }
+
+      return length;
+   }
+}

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,513 @@
+/*
+ * Copyright 2009 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.hornetq.core.protocol.core.impl;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CommandConfirmationHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+
+/**
+ * A ChannelImpl
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ */
+public class ChannelImpl implements Channel
+{
+   private static final Logger log = Logger.getLogger(ChannelImpl.class);
+
+   private volatile long id;
+
+   private ChannelHandler handler;
+
+   private Packet response;
+
+   private final java.util.Queue<Packet> resendCache;
+
+   private volatile int firstStoredCommandID;
+
+   private volatile int lastConfirmedCommandID = -1;
+
+   private volatile CoreRemotingConnection connection;
+
+   private volatile boolean closed;
+
+   private final Lock lock = new ReentrantLock();
+
+   private final Condition sendCondition = lock.newCondition();
+
+   private final Condition failoverCondition = lock.newCondition();
+
+   private final Object sendLock = new Object();
+
+   private final Object sendBlockingLock = new Object();
+
+   private boolean failingOver;
+
+   private final int confWindowSize;
+
+   private int receivedBytes;
+
+   private CommandConfirmationHandler commandConfirmationHandler;
+      
+   private volatile boolean transferring;
+ 
+   public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
+   {
+      this.connection = connection;
+
+      this.id = id;
+
+      this.confWindowSize = confWindowSize;
+
+      if (confWindowSize != -1)
+      {
+         resendCache = new ConcurrentLinkedQueue<Packet>();
+      }
+      else
+      {
+         resendCache = null;
+      }
+   }
+
+   public long getID()
+   {
+      return id;
+   }
+
+   public int getLastConfirmedCommandID()
+   {
+      return lastConfirmedCommandID;
+   }
+
+   public Lock getLock()
+   {
+      return lock;
+   }
+
+   public int getConfirmationWindowSize()
+   {
+      return confWindowSize;
+   }
+
+   public void returnBlocking()
+   {
+      lock.lock();
+
+      try
+      {
+         response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
+                                                                     "Connection failure detected. Unblocking a blocking call that will never get a response"
+
+         ));
+
+         sendCondition.signal();
+      }
+      finally
+      {
+         lock.unlock();
+      }
+   }
+
+   public void sendAndFlush(final Packet packet)
+   {
+      send(packet, true);
+   }
+
+   public void send(final Packet packet)
+   {
+      send(packet, false);
+   }
+   
+   public void setTransferring(boolean transferring)
+   {
+      this.transferring = transferring;
+   }
+
+   // This must never called by more than one thread concurrently
+   public void send(final Packet packet, final boolean flush)
+   {
+      synchronized (sendLock)
+      {
+         packet.setChannelID(id);
+         
+         final HornetQBuffer buffer = packet.encode(connection);
+
+         lock.lock();
+                  
+         try
+         {
+            while (failingOver)
+            {
+               // TODO - don't hardcode this timeout
+               try
+               {
+                  failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+               }
+               catch (InterruptedException e)
+               {
+               }
+            }
+            
+            //Sanity check
+            if (transferring)
+            {
+               throw new IllegalStateException("Cannot send a packet while channel is doing failover");
+            }
+            
+
+            if (resendCache != null && packet.isRequiresConfirmations())
+            {
+               resendCache.add(packet);
+            }
+
+            connection.getTransportConnection().write(buffer, flush);
+         }
+         finally
+         {
+            lock.unlock();
+         }
+      }
+   }
+
+   public Packet sendBlocking(final Packet packet) throws HornetQException
+   {
+      if (closed)
+      {
+         throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
+      }
+
+      if (connection.getBlockingCallTimeout() == -1)
+      {
+         throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
+      }
+
+      // Synchronized since can't be called concurrently by more than one thread and this can occur
+      // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
+      synchronized (sendBlockingLock)
+      {
+         packet.setChannelID(id);
+         
+         final HornetQBuffer buffer = packet.encode(connection);
+
+         lock.lock();
+
+         try
+         {
+            while (failingOver)
+            {
+               // TODO - don't hardcode this timeout
+               try
+               {
+                  failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+               }
+               catch (InterruptedException e)
+               {
+               }
+            }
+
+            response = null;
+
+            if (resendCache != null && packet.isRequiresConfirmations())
+            {
+               resendCache.add(packet);
+            }
+
+            connection.getTransportConnection().write(buffer);
+
+            long toWait = connection.getBlockingCallTimeout();
+
+            long start = System.currentTimeMillis();
+
+            while (response == null && toWait > 0)
+            {
+               try
+               {
+                  sendCondition.await(toWait, TimeUnit.MILLISECONDS);
+               }
+               catch (InterruptedException e)
+               {
+               }
+
+               if (closed)
+               {
+                  break;
+               }
+
+               final long now = System.currentTimeMillis();
+
+               toWait -= now - start;
+
+               start = now;
+            }
+
+            if (response == null)
+            {
+               throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
+                                          "Timed out waiting for response when sending packet " + packet.getType());
+            }
+
+            if (response.getType() == PacketImpl.EXCEPTION)
+            {
+               final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
+
+               HornetQException e = mem.getException();
+
+               e.fillInStackTrace();
+
+               throw e;
+            }
+         }
+         finally
+         {
+            lock.unlock();
+         }
+
+         return response;
+      }
+   }
+
+   public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
+   {
+      commandConfirmationHandler = handler;
+   }
+
+   public void setHandler(final ChannelHandler handler)
+   {
+      this.handler = handler;
+   }
+
+   public void close()
+   {
+      if (closed)
+      {
+         return;
+      }
+
+      if (!connection.isDestroyed() && !connection.removeChannel(id))
+      {
+         throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
+      }
+
+      closed = true;
+   }
+   
+   public void transferConnection(final CoreRemotingConnection newConnection)
+   {
+      // Needs to synchronize on the connection to make sure no packets from
+      // the old connection get processed after transfer has occurred
+      synchronized (connection.getTransferLock())
+      {
+         connection.removeChannel(id);
+
+         // And switch it
+
+         final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
+
+         rnewConnection.putChannel(id, this);
+
+         connection = rnewConnection;
+
+         transferring = true;
+      }
+   }
+
+   public void replayCommands(final int otherLastConfirmedCommandID)
+   {
+      if (resendCache != null)
+      {
+         clearUpTo(otherLastConfirmedCommandID);
+
+         for (final Packet packet : resendCache)
+         {
+            doWrite(packet);
+         }
+      }
+   }
+
+   public void lock()
+   {
+      lock.lock();
+
+      failingOver = true;
+
+      lock.unlock();
+   }
+
+   public void unlock()
+   {
+      lock.lock();
+
+      failingOver = false;
+
+      failoverCondition.signalAll();
+
+      lock.unlock();
+   }
+
+   public CoreRemotingConnection getConnection()
+   {
+      return connection;
+   }
+   
+   //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
+   public synchronized void flushConfirmations()
+   {
+      if (resendCache != null && receivedBytes != 0)
+      {
+         receivedBytes = 0;
+
+         final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
+
+         confirmed.setChannelID(id);
+
+         doWrite(confirmed);
+      }
+   }
+
+   public void confirm(final Packet packet)
+   {
+      if (resendCache != null && packet.isRequiresConfirmations())
+      {
+         lastConfirmedCommandID++;
+
+         receivedBytes += packet.getPacketSize();
+
+         if (receivedBytes >= confWindowSize)
+         {
+            receivedBytes = 0;
+
+            final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
+
+            confirmed.setChannelID(id);
+
+            doWrite(confirmed);
+         }
+      }
+   }
+
+   public void clearCommands()
+   {
+      if (resendCache != null)
+      {
+         lastConfirmedCommandID = -1;
+
+         firstStoredCommandID = 0;
+
+         resendCache.clear();
+      }
+   }
+   
+   public void handlePacket(final Packet packet)
+   {
+      if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
+      {
+         if (resendCache != null)
+         {
+            final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
+
+            clearUpTo(msg.getCommandID());
+         }
+
+         if (!connection.isClient())
+         {
+            handler.handlePacket(packet);
+         }
+
+         return;
+      }
+      else
+      {
+         if (packet.isResponse())
+         {
+            confirm(packet);
+
+            lock.lock();
+
+            response = packet;
+
+            try
+            {
+               sendCondition.signal();
+            }
+            finally
+            {
+               lock.unlock();
+            }
+         }
+         else if (handler != null)
+         {
+            handler.handlePacket(packet);
+         }
+      }
+   }
+
+   private void doWrite(final Packet packet)
+   {
+      final HornetQBuffer buffer = packet.encode(connection);
+
+      connection.getTransportConnection().write(buffer);
+   }
+
+   private void clearUpTo(final int lastReceivedCommandID)
+   {
+      final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
+
+      if (numberToClear == -1)
+      {
+         throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
+      }
+
+      int sizeToFree = 0;
+
+      for (int i = 0; i < numberToClear; i++)
+      {
+         final Packet packet = resendCache.poll();
+
+         if (packet == null)
+         {
+            ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
+                                 lastReceivedCommandID +
+                                 " first stored command id " +
+                                 firstStoredCommandID);
+            return;
+         }
+
+         if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
+         {
+            sizeToFree += packet.getPacketSize();
+         }
+
+         if (commandConfirmationHandler != null)
+         {
+            commandConfirmationHandler.commandConfirmed(packet);
+         }
+      }
+
+      firstStoredCommandID += numberToClear;
+   }
+}

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2010 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.hornetq.core.protocol.core.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A CoreProtocolManager
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class CoreProtocolManager implements ProtocolManager
+{
+   private final HornetQServer server;
+   
+   private final List<Interceptor> interceptors;
+
+   public CoreProtocolManager(final HornetQServer server,
+                              final List<Interceptor> interceptors)
+   {
+      this.server = server;
+
+      this.interceptors = interceptors;
+   }
+
+   public ConnectionEntry createConnectionEntry(final Connection connection)
+   {
+      final Configuration config = server.getConfiguration();
+      
+      CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
+                                                             interceptors,
+                                                             config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
+                                                                                                       : null);
+
+      Channel channel1 = rc.getChannel(1, -1);
+
+      ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
+
+      channel1.setHandler(handler);
+
+      long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
+
+      if (config.getConnectionTTLOverride() != -1)
+      {
+         ttl = config.getConnectionTTLOverride();
+      }
+
+      final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
+
+      final Channel channel0 = rc.getChannel(0, -1);
+
+      channel0.setHandler(new ChannelHandler()
+      {
+         public void handlePacket(final Packet packet)
+         {
+            if (packet.getType() == PacketImpl.PING)
+            {
+               Ping ping = (Ping)packet;
+
+               if (config.getConnectionTTLOverride() == -1)
+               {
+                  // Allow clients to specify connection ttl
+                  entry.ttl = ping.getConnectionTTL();
+               }
+
+               // Just send a ping back
+               channel0.send(packet);
+            }
+         }
+      });
+
+      return entry;
+   }
+   
+   private Map<String, ServerSessionPacketHandler> sessionHandlers = 
+      new ConcurrentHashMap<String, ServerSessionPacketHandler>();
+   
+   public ServerSessionPacketHandler getSessionHandler(final String sessionName)
+   {
+      return sessionHandlers.get(sessionName);
+   }
+   
+   public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
+   {
+      sessionHandlers.put(name, handler);
+   }
+   
+   public void removeHandler(final String name)
+   {
+      sessionHandlers.remove(name);
+   }
+
+   public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+   {
+   }
+
+   public int isReadyToHandle(HornetQBuffer buffer)
+   {
+      return -1;
+   }
+}

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,315 @@
+/*
+ * Copyright 2009 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.hornetq.core.protocol.core.impl;
+
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.replication.ReplicationEndpoint;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.ServerSession;
+import org.hornetq.core.version.Version;
+
+/**
+ * A packet handler for all packets that need to be handled at the server level
+ * 
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class HornetQPacketHandler implements ChannelHandler
+{
+   private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
+
+   private final HornetQServer server;
+
+   private final Channel channel1;
+
+   private final CoreRemotingConnection connection;
+
+   private final CoreProtocolManager protocolManager;
+
+   public HornetQPacketHandler(final CoreProtocolManager protocolManager,
+                               final HornetQServer server,
+                               final Channel channel1,
+                               final CoreRemotingConnection connection)
+   {
+      this.protocolManager = protocolManager;
+
+      this.server = server;
+
+      this.channel1 = channel1;
+
+      this.connection = connection;
+   }
+
+   public void handlePacket(final Packet packet)
+   {
+      byte type = packet.getType();
+
+      switch (type)
+      {
+         case CREATESESSION:
+         {
+            CreateSessionMessage request = (CreateSessionMessage)packet;
+
+            handleCreateSession(request);
+
+            break;
+         }
+         case REATTACH_SESSION:
+         {
+            ReattachSessionMessage request = (ReattachSessionMessage)packet;
+
+            handleReattachSession(request);
+
+            break;
+         }
+         case CREATE_QUEUE:
+         {
+            // Create queue can also be fielded here in the case of a replicated store and forward queue creation
+
+            CreateQueueMessage request = (CreateQueueMessage)packet;
+
+            handleCreateQueue(request);
+
+            break;
+         }
+         case CREATE_REPLICATION:
+         {
+            // Create queue can also be fielded here in the case of a replicated store and forward queue creation
+
+            CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
+
+            handleCreateReplication(request);
+
+            break;
+         }
+         default:
+         {
+            HornetQPacketHandler.log.error("Invalid packet " + packet);
+         }
+      }
+   }
+
+   private void handleCreateSession(final CreateSessionMessage request)
+   {
+      boolean incompatibleVersion = false;
+      Packet response;
+      try
+      {
+         Version version = server.getVersion();
+
+         if (version.getIncrementingVersion() != request.getVersion())
+         {
+            log.warn("Client with version " + request.getVersion() +
+                     " and address " +
+                     connection.getRemoteAddress() +
+                     " is not compatible with server version " +
+                     version.getFullVersion() +
+                     ". " +
+                     "Please ensure all clients and servers are upgraded to the same version for them to " +
+                     "interoperate properly");
+            throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
+                                       "Server and client versions incompatible");
+         }
+
+         if (!server.isStarted())
+         {
+            throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
+         }
+
+         if (!server.checkActivate())
+         {
+            throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
+                                       "Server will not accept create session requests");
+         }
+
+         Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
+
+         ServerSession session = server.createSession(request.getName(),                                                      
+                                                      request.getUsername(),
+                                                      request.getPassword(),
+                                                      request.getMinLargeMessageSize(),                                                    
+                                                      connection,
+                                                      request.isAutoCommitSends(),
+                                                      request.isAutoCommitAcks(),
+                                                      request.isPreAcknowledge(),
+                                                      request.isXA());
+
+         ServerSessionPacketHandler handler = new ServerSessionPacketHandler(protocolManager,
+                                                                             session,
+                                                                             server.getStorageManager()
+                                                                                   .newContext(server.getExecutorFactory()
+                                                                                                     .getExecutor()),
+                                                                             server.getStorageManager(),
+                                                                             channel);
+
+         session.setCallback(handler);
+
+         channel.setHandler(handler);
+
+         // TODO - where is this removed?
+         protocolManager.addSessionHandler(request.getName(), handler);
+
+         response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
+      }
+      catch (HornetQException e)
+      {
+         response = new HornetQExceptionMessage((HornetQException)e);
+
+         if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
+         {
+            incompatibleVersion = true;
+         }
+      }
+      catch (Exception e)
+      {
+         HornetQPacketHandler.log.error("Failed to create session", e);
+         
+         response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+      }
+
+      // send the exception to the client and destroy
+      // the connection if the client and server versions
+      // are not compatible
+      if (incompatibleVersion)
+      {
+         channel1.sendAndFlush(response);
+      }
+      else
+      {
+         channel1.send(response);
+      }
+   }
+
+   private void handleReattachSession(final ReattachSessionMessage request)
+   {
+      Packet response = null;
+      
+      try
+      {
+   
+         if (!server.isStarted())
+         {
+            response = new ReattachSessionResponseMessage(-1, false);
+         }
+   
+         ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
+         
+         if (!server.checkActivate())
+         {
+            response = new ReattachSessionResponseMessage(-1, false);
+         }
+   
+         if (sessionHandler == null)
+         {
+            response = new ReattachSessionResponseMessage(-1, false);
+         }
+         else
+         {
+            if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
+            {
+               // Even though session exists, we can't reattach since confi window size == -1,
+               // i.e. we don't have a resend cache for commands, so we just close the old session
+               // and let the client recreate
+   
+               sessionHandler.close();
+   
+               response = new ReattachSessionResponseMessage(-1, false);
+            }
+            else
+            {
+               // Reconnect the channel to the new connection
+               int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
+                                                                                    request.getLastConfirmedCommandID());
+   
+               response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         HornetQPacketHandler.log.error("Failed to reattach session", e);
+         
+         response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+      }
+
+      channel1.send(response);
+   }
+
+   private void handleCreateQueue(final CreateQueueMessage request)
+   {
+      try
+      {
+         server.createQueue(request.getAddress(),
+                            request.getQueueName(),
+                            request.getFilterString(),
+                            request.isDurable(),
+                            request.isTemporary());
+      }
+      catch (Exception e)
+      {
+         HornetQPacketHandler.log.error("Failed to handle create queue", e);
+      }
+   }
+
+   private void handleCreateReplication(final CreateReplicationSessionMessage request)
+   {
+      Packet response;
+
+      try
+      {
+         Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
+
+         ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
+
+         channel.setHandler(endpoint);
+
+         response = new NullResponseMessage();
+      }
+      catch (Exception e)
+      {
+         if (e instanceof HornetQException)
+         {
+            response = new HornetQExceptionMessage((HornetQException)e);
+         }
+         else
+         {
+            HornetQPacketHandler.log.warn(e.getMessage(), e);
+            response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+         }
+      }
+
+      channel1.send(response);
+   }
+
+}
\ No newline at end of file

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,493 @@
+/*
+ * Copyright 2009 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.hornetq.core.protocol.core.impl;
+
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DISCONNECT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.NULL_RESPONSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.PACKETS_CONFIRMED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.PING;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND_TX;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMPARE_DATA;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE_TX;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_EVENT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_WRITE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_CREDITS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
+
+/**
+ * A PacketDecoder
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class PacketDecoder
+{
+   private static final Logger log = Logger.getLogger(PacketDecoder.class);
+
+   public Packet decode(final HornetQBuffer in)
+   {
+      final byte packetType = in.readByte();
+
+      Packet packet;
+
+      switch (packetType)
+      {
+         case PING:
+         {
+            packet = new Ping();
+            break;
+         }
+         case DISCONNECT:
+         {
+            packet = new PacketImpl(PacketImpl.DISCONNECT);
+            break;
+         }
+         case EXCEPTION:
+         {
+            packet = new HornetQExceptionMessage();
+            break;
+         }
+         case PACKETS_CONFIRMED:
+         {
+            packet = new PacketsConfirmedMessage();
+            break;
+         }
+         case CREATESESSION:
+         {
+            packet = new CreateSessionMessage();
+            break;
+         }
+         case CREATESESSION_RESP:
+         {
+            packet = new CreateSessionResponseMessage();
+            break;
+         }
+         case REATTACH_SESSION:
+         {
+            packet = new ReattachSessionMessage();
+            break;
+         }
+         case REATTACH_SESSION_RESP:
+         {
+            packet = new ReattachSessionResponseMessage();
+            break;
+         }
+         case SESS_CLOSE:
+         {
+            packet = new SessionCloseMessage();
+            break;
+         }
+         case SESS_CREATECONSUMER:
+         {
+            packet = new SessionCreateConsumerMessage();
+            break;
+         }
+         case SESS_ACKNOWLEDGE:
+         {
+            packet = new SessionAcknowledgeMessage();
+            break;
+         }
+         case SESS_EXPIRED:
+         {
+            packet = new SessionExpiredMessage();
+            break;
+         }
+         case SESS_COMMIT:
+         {
+            packet = new SessionCommitMessage();
+            break;
+         }
+         case SESS_ROLLBACK:
+         {
+            packet = new RollbackMessage();
+            break;
+         }
+         case SESS_QUEUEQUERY:
+         {
+            packet = new SessionQueueQueryMessage();
+            break;
+         }
+         case SESS_QUEUEQUERY_RESP:
+         {
+            packet = new SessionQueueQueryResponseMessage();
+            break;
+         }
+         case CREATE_QUEUE:
+         {
+            packet = new CreateQueueMessage();
+            break;
+         }
+         case DELETE_QUEUE:
+         {
+            packet = new SessionDeleteQueueMessage();
+            break;
+         }
+         case SESS_BINDINGQUERY:
+         {
+            packet = new SessionBindingQueryMessage();
+            break;
+         }
+         case SESS_BINDINGQUERY_RESP:
+         {
+            packet = new SessionBindingQueryResponseMessage();
+            break;
+         }
+         case SESS_XA_START:
+         {
+            packet = new SessionXAStartMessage();
+            break;
+         }
+         case SESS_XA_END:
+         {
+            packet = new SessionXAEndMessage();
+            break;
+         }
+         case SESS_XA_COMMIT:
+         {
+            packet = new SessionXACommitMessage();
+            break;
+         }
+         case SESS_XA_PREPARE:
+         {
+            packet = new SessionXAPrepareMessage();
+            break;
+         }
+         case SESS_XA_RESP:
+         {
+            packet = new SessionXAResponseMessage();
+            break;
+         }
+         case SESS_XA_ROLLBACK:
+         {
+            packet = new SessionXARollbackMessage();
+            break;
+         }
+         case SESS_XA_JOIN:
+         {
+            packet = new SessionXAJoinMessage();
+            break;
+         }
+         case SESS_XA_SUSPEND:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
+            break;
+         }
+         case SESS_XA_RESUME:
+         {
+            packet = new SessionXAResumeMessage();
+            break;
+         }
+         case SESS_XA_FORGET:
+         {
+            packet = new SessionXAForgetMessage();
+            break;
+         }
+         case SESS_XA_INDOUBT_XIDS:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
+            break;
+         }
+         case SESS_XA_INDOUBT_XIDS_RESP:
+         {
+            packet = new SessionXAGetInDoubtXidsResponseMessage();
+            break;
+         }
+         case SESS_XA_SET_TIMEOUT:
+         {
+            packet = new SessionXASetTimeoutMessage();
+            break;
+         }
+         case SESS_XA_SET_TIMEOUT_RESP:
+         {
+            packet = new SessionXASetTimeoutResponseMessage();
+            break;
+         }
+         case SESS_XA_GET_TIMEOUT:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
+            break;
+         }
+         case SESS_XA_GET_TIMEOUT_RESP:
+         {
+            packet = new SessionXAGetTimeoutResponseMessage();
+            break;
+         }
+         case SESS_START:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_START);
+            break;
+         }
+         case SESS_STOP:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_STOP);
+            break;
+         }
+         case SESS_FLOWTOKEN:
+         {
+            packet = new SessionConsumerFlowCreditMessage();
+            break;
+         }
+         case SESS_SEND:
+         {
+            packet = new SessionSendMessage();
+            break;
+         }
+         case SESS_SEND_LARGE:
+         {
+            packet = new SessionSendLargeMessage();
+            break;
+         }
+         case SESS_RECEIVE_MSG:
+         {
+            packet = new SessionReceiveMessage();
+            break;
+         }
+         case SESS_RECEIVE_LARGE_MSG:
+         {
+            packet = new SessionReceiveLargeMessage();
+            break;
+         }
+         case SESS_CONSUMER_CLOSE:
+         {
+            packet = new SessionConsumerCloseMessage();
+            break;
+         }
+         case NULL_RESPONSE:
+         {
+            packet = new NullResponseMessage();
+            break;
+         }
+         case SESS_RECEIVE_CONTINUATION:
+         {
+            packet = new SessionReceiveContinuationMessage();
+            break;
+         }
+         case SESS_SEND_CONTINUATION:
+         {
+            packet = new SessionSendContinuationMessage();
+            break;
+         }
+         case SESS_PRODUCER_REQUEST_CREDITS:
+         {
+            packet = new SessionRequestProducerCreditsMessage();
+            break;
+         }
+         case SESS_PRODUCER_CREDITS:
+         {
+            packet = new SessionProducerCreditsMessage();
+            break;
+         }
+         case CREATE_REPLICATION:
+         {
+            packet = new CreateReplicationSessionMessage();
+            break;
+         }
+         case REPLICATION_APPEND:
+         {
+            packet = new ReplicationAddMessage();
+            break;
+         }
+         case REPLICATION_APPEND_TX:
+         {
+            packet = new ReplicationAddTXMessage();
+            break;
+         }
+         case REPLICATION_DELETE:
+         {
+            packet = new ReplicationDeleteMessage();
+            break;
+         }
+         case REPLICATION_DELETE_TX:
+         {
+            packet = new ReplicationDeleteTXMessage();
+            break;
+         }
+         case REPLICATION_PREPARE:
+         {
+            packet = new ReplicationPrepareMessage();
+            break;
+         }
+         case REPLICATION_COMMIT_ROLLBACK:
+         {
+            packet = new ReplicationCommitMessage();
+            break;
+         }
+         case REPLICATION_RESPONSE:
+         {
+            packet = new ReplicationResponseMessage();
+            break;
+         }
+         case REPLICATION_PAGE_WRITE:
+         {
+            packet = new ReplicationPageWriteMessage();
+            break;
+         }
+         case REPLICATION_PAGE_EVENT:
+         {
+            packet = new ReplicationPageEventMessage();
+            break;
+         }
+         case REPLICATION_LARGE_MESSAGE_BEGIN:
+         {
+            packet = new ReplicationLargeMessageBeingMessage();
+            break;
+         }
+         case REPLICATION_LARGE_MESSAGE_END:
+         {
+            packet = new ReplicationLargemessageEndMessage();
+            break;
+         }
+         case REPLICATION_LARGE_MESSAGE_WRITE:
+         {
+            packet = new ReplicationLargeMessageWriteMessage();
+            break;
+         }
+         case REPLICATION_COMPARE_DATA:
+         {
+            packet = new ReplicationCompareDataMessage();
+            break;
+         }
+         case SESS_FORCE_CONSUMER_DELIVERY:
+         {
+            packet = new SessionForceConsumerDelivery();
+            break;
+         }
+         default:
+         {
+            throw new IllegalArgumentException("Invalid type: " + packetType);
+         }
+      }
+
+      packet.decode(in);
+
+      return packet;
+   }
+
+}

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,311 @@
+/*
+ * Copyright 2009 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.hornetq.core.protocol.core.impl;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class PacketImpl implements Packet
+{
+   // Constants -------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(PacketImpl.class);
+
+   // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
+   public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
+                                                 DataConstants.SIZE_LONG;
+
+   private static final int INITIAL_PACKET_SIZE = 1500;
+
+   protected long channelID;
+
+   protected final byte type;
+
+   protected int size = -1;
+
+   // The packet types
+   // -----------------------------------------------------------------------------------
+
+   public static final byte PING = 10;
+
+   public static final byte DISCONNECT = 11;
+
+   // Miscellaneous
+   public static final byte EXCEPTION = 20;
+
+   public static final byte NULL_RESPONSE = 21;
+
+   public static final byte PACKETS_CONFIRMED = 22;
+
+   // Server
+   public static final byte CREATESESSION = 30;
+
+   public static final byte CREATESESSION_RESP = 31;
+
+   public static final byte REATTACH_SESSION = 32;
+
+   public static final byte REATTACH_SESSION_RESP = 33;
+
+   public static final byte CREATE_QUEUE = 34;
+
+   public static final byte DELETE_QUEUE = 35;
+
+   public static final byte CREATE_REPLICATION = 36;
+
+   // Session
+   public static final byte SESS_CREATECONSUMER = 40;
+
+   public static final byte SESS_ACKNOWLEDGE = 41;
+
+   public static final byte SESS_EXPIRED = 42;
+
+   public static final byte SESS_COMMIT = 43;
+
+   public static final byte SESS_ROLLBACK = 44;
+
+   public static final byte SESS_QUEUEQUERY = 45;
+
+   public static final byte SESS_QUEUEQUERY_RESP = 46;
+
+   public static final byte SESS_BINDINGQUERY = 49;
+
+   public static final byte SESS_BINDINGQUERY_RESP = 50;
+
+   public static final byte SESS_XA_START = 51;
+
+   public static final byte SESS_XA_END = 52;
+
+   public static final byte SESS_XA_COMMIT = 53;
+
+   public static final byte SESS_XA_PREPARE = 54;
+
+   public static final byte SESS_XA_RESP = 55;
+
+   public static final byte SESS_XA_ROLLBACK = 56;
+
+   public static final byte SESS_XA_JOIN = 57;
+
+   public static final byte SESS_XA_SUSPEND = 58;
+
+   public static final byte SESS_XA_RESUME = 59;
+
+   public static final byte SESS_XA_FORGET = 60;
+
+   public static final byte SESS_XA_INDOUBT_XIDS = 61;
+
+   public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
+
+   public static final byte SESS_XA_SET_TIMEOUT = 63;
+
+   public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
+
+   public static final byte SESS_XA_GET_TIMEOUT = 65;
+
+   public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
+
+   public static final byte SESS_START = 67;
+
+   public static final byte SESS_STOP = 68;
+
+   public static final byte SESS_CLOSE = 69;
+
+   public static final byte SESS_FLOWTOKEN = 70;
+
+   public static final byte SESS_SEND = 71;
+
+   public static final byte SESS_SEND_LARGE = 72;
+
+   public static final byte SESS_SEND_CONTINUATION = 73;
+
+   public static final byte SESS_CONSUMER_CLOSE = 74;
+
+   public static final byte SESS_RECEIVE_MSG = 75;
+
+   public static final byte SESS_RECEIVE_LARGE_MSG = 76;
+
+   public static final byte SESS_RECEIVE_CONTINUATION = 77;
+
+   public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
+
+   public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
+
+   public static final byte SESS_PRODUCER_CREDITS = 80;
+
+   // Replication
+
+   public static final byte REPLICATION_RESPONSE = 90;
+
+   public static final byte REPLICATION_APPEND = 91;
+
+   public static final byte REPLICATION_APPEND_TX = 92;
+
+   public static final byte REPLICATION_DELETE = 93;
+
+   public static final byte REPLICATION_DELETE_TX = 94;
+
+   public static final byte REPLICATION_PREPARE = 95;
+
+   public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
+
+   public static final byte REPLICATION_PAGE_WRITE = 97;
+
+   public static final byte REPLICATION_PAGE_EVENT = 98;
+
+   public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
+
+   public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
+
+   public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
+
+   public static final byte REPLICATION_COMPARE_DATA = 102;
+
+   public static final byte REPLICATION_SYNC = 103;
+
+   // Static --------------------------------------------------------
+
+   public PacketImpl(final byte type)
+   {
+      this.type = type;
+   }
+
+   // Public --------------------------------------------------------
+
+   public byte getType()
+   {
+      return type;
+   }
+
+   public long getChannelID()
+   {
+      return channelID;
+   }
+
+   public void setChannelID(final long channelID)
+   {
+      this.channelID = channelID;
+   }
+
+   public HornetQBuffer encode(final RemotingConnection connection)
+   {
+      HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
+
+      // The standard header fields
+
+      buffer.writeInt(0); // The length gets filled in at the end
+      buffer.writeByte(type);
+      buffer.writeLong(channelID);
+
+      encodeRest(buffer);
+
+      size = buffer.writerIndex();
+
+      // The length doesn't include the actual length byte
+      int len = size - DataConstants.SIZE_INT;
+
+      buffer.setInt(0, len);
+
+      return buffer;
+   }
+
+   public void decode(final HornetQBuffer buffer)
+   {
+      channelID = buffer.readLong();
+
+      decodeRest(buffer);
+
+      size = buffer.readerIndex();
+   }
+
+   public int getPacketSize()
+   {
+      if (size == -1)
+      {
+         throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
+      }
+
+      return size;
+   }
+
+   public boolean isResponse()
+   {
+      return false;
+   }
+
+   public void encodeRest(final HornetQBuffer buffer)
+   {
+   }
+
+   public void decodeRest(final HornetQBuffer buffer)
+   {
+   }
+
+   public boolean isRequiresConfirmations()
+   {
+      return true;
+   }
+   
+   public boolean isAsyncExec()
+   {
+      return false;
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + "]";
+   }
+
+   @Override
+   public boolean equals(final Object other)
+   {
+      if (other instanceof PacketImpl == false)
+      {
+         return false;
+      }
+
+      PacketImpl r = (PacketImpl)other;
+
+      return r.type == type && r.channelID == channelID;
+   }
+
+   // Package protected ---------------------------------------------
+
+   protected String getParentString()
+   {
+      return "PACKET[type=" + type + ", channelID=" + channelID + "]";
+   }
+
+   // Protected -----------------------------------------------------
+
+   protected int stringEncodeSize(final String str)
+   {
+      return DataConstants.SIZE_INT + str.length() * 2;
+   }
+
+   protected int nullableStringEncodeSize(final String str)
+   {
+      return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
+   }
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,511 @@
+/*
+ * Copyright 2009 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.hornetq.core.protocol.core.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.Connection;
+import org.hornetq.utils.SimpleIDGenerator;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @version <tt>$Revision$</tt> $Id$
+ */
+public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
+{
+   // Constants
+   // ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+   // Static
+   // ---------------------------------------------------------------------------------------
+
+   // Attributes
+   // -----------------------------------------------------------------------------------
+
+   private final Connection transportConnection;
+
+   private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
+
+   private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
+
+   private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
+
+   private final long blockingCallTimeout;
+
+   private final List<Interceptor> interceptors;
+
+   private volatile boolean destroyed;
+
+   private final boolean client;
+
+   // Channels 0-9 are reserved for the system
+   // 0 is for pinging
+   // 1 is for session creation and attachment
+   // 2 is for replication
+   private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
+
+   private boolean idGeneratorSynced = false;
+
+   private final Object transferLock = new Object();
+
+   private final Object failLock = new Object();
+
+   private final PacketDecoder decoder = new PacketDecoder();
+
+   private volatile boolean dataReceived;
+
+   private final Executor executor;
+   
+   private volatile boolean executing;
+
+   // Constructors
+   // ---------------------------------------------------------------------------------
+
+   /*
+    * Create a client side connection
+    */
+   public RemotingConnectionImpl(final Connection transportConnection,
+                                 final long blockingCallTimeout,
+                                 final List<Interceptor> interceptors)
+   {
+      this(transportConnection, blockingCallTimeout, interceptors, true, null);
+   }
+
+   /*
+    * Create a server side connection
+    */
+   public RemotingConnectionImpl(final Connection transportConnection,
+                                 final List<Interceptor> interceptors,
+                                 final Executor executor)
+
+   {
+      this(transportConnection, -1, interceptors, false, executor);
+   }
+
+   private RemotingConnectionImpl(final Connection transportConnection,
+                                  final long blockingCallTimeout,
+                                  final List<Interceptor> interceptors,
+                                  final boolean client,
+                                  final Executor executor)
+
+   {
+      this.transportConnection = transportConnection;
+
+      this.blockingCallTimeout = blockingCallTimeout;
+
+      this.interceptors = interceptors;
+
+      this.client = client;
+
+      this.executor = executor;
+   }
+
+   // RemotingConnection implementation
+   // ------------------------------------------------------------
+
+   public Connection getTransportConnection()
+   {
+      return transportConnection;
+   }
+
+   public List<FailureListener> getFailureListeners()
+   {
+      return new ArrayList<FailureListener>(failureListeners);
+   }
+
+   public void setFailureListeners(final List<FailureListener> listeners)
+   {
+      failureListeners.clear();
+
+      failureListeners.addAll(listeners);
+   }
+
+   public Object getID()
+   {
+      return transportConnection.getID();
+   }
+
+   public String getRemoteAddress()
+   {
+      return transportConnection.getRemoteAddress();
+   }
+
+   public synchronized Channel getChannel(final long channelID, final int confWindowSize)
+   {
+      Channel channel = channels.get(channelID);
+
+      if (channel == null)
+      {
+         channel = new ChannelImpl(this, channelID, confWindowSize);
+
+         channels.put(channelID, channel);
+      }
+
+      return channel;
+   }
+
+   public synchronized boolean removeChannel(final long channelID)
+   {
+      return channels.remove(channelID) != null;
+   }
+
+   public synchronized void putChannel(final long channelID, final Channel channel)
+   {
+      channels.put(channelID, channel);
+   }
+
+   public void addFailureListener(final FailureListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalStateException("FailureListener cannot be null");
+      }
+
+      failureListeners.add(listener);
+   }
+
+   public boolean removeFailureListener(final FailureListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalStateException("FailureListener cannot be null");
+      }
+
+      return failureListeners.remove(listener);
+   }
+
+   public void addCloseListener(final CloseListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalStateException("CloseListener cannot be null");
+      }
+
+      closeListeners.add(listener);
+   }
+
+   public boolean removeCloseListener(final CloseListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalStateException("CloseListener cannot be null");
+      }
+
+      return closeListeners.remove(listener);
+   }
+
+   public HornetQBuffer createBuffer(final int size)
+   {
+      return transportConnection.createBuffer(size);
+   }
+
+   /*
+    * This can be called concurrently by more than one thread so needs to be locked
+    */
+   public void fail(final HornetQException me)
+   {
+      synchronized (failLock)
+      {
+         if (destroyed)
+         {
+            return;
+         }
+
+         destroyed = true;
+      }
+
+      RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
+                                      " [code=" +
+                                      me.getCode() +
+                                      "]");
+
+      // Then call the listeners
+      callFailureListeners(me);
+
+      callClosingListeners();
+
+      internalClose();
+
+      for (Channel channel : channels.values())
+      {
+         channel.returnBlocking();
+      }
+   }
+
+   public void destroy()
+   {
+      synchronized (failLock)
+      {
+         if (destroyed)
+         {
+            return;
+         }
+
+         destroyed = true;
+      }
+
+      internalClose();
+
+      callClosingListeners();
+   }
+   
+   public void disconnect()
+   {
+      Channel channel0 = getChannel(0, -1);
+
+      // And we remove all channels from the connection, this ensures no more packets will be processed after this
+      // method is
+      // complete
+      
+      Set<Channel> allChannels = new HashSet<Channel>(channels.values());
+
+      removeAllChannels();
+
+      // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
+      
+      for (Channel channel: allChannels)
+      {
+         channel.flushConfirmations();
+      }
+
+      channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
+   }
+
+   public long generateChannelID()
+   {
+      return idGenerator.generateID();
+   }
+
+   public synchronized void syncIDGeneratorSequence(final long id)
+   {
+      if (!idGeneratorSynced)
+      {
+         idGenerator = new SimpleIDGenerator(id);
+
+         idGeneratorSynced = true;
+      }
+   }
+
+   public long getIDGeneratorSequence()
+   {
+      return idGenerator.getCurrentID();
+   }
+
+   public Object getTransferLock()
+   {
+      return transferLock;
+   }
+
+   public boolean isClient()
+   {
+      return client;
+   }
+
+   public boolean isDestroyed()
+   {
+      return destroyed;
+   }
+
+   public long getBlockingCallTimeout()
+   {
+      return blockingCallTimeout;
+   }
+
+   public boolean checkDataReceived()
+   {
+      boolean res = dataReceived;
+
+      dataReceived = false;
+
+      return res;
+   }
+
+   //We flush any confirmations on the connection - this prevents idle bridges for example
+   //sitting there with many unacked messages
+   public void flush()
+   {
+      synchronized (transferLock)
+      {
+         for (Channel channel : channels.values())
+         {
+            channel.flushConfirmations();
+         }
+      }
+   }
+
+   // Buffer Handler implementation
+   // ----------------------------------------------------
+
+   public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
+   {
+      final Packet packet = decoder.decode(buffer);
+
+      if (packet.isAsyncExec() && executor != null)
+      {
+         executing = true;
+
+         executor.execute(new Runnable()
+         {
+            public void run()
+            {
+               try
+               {
+                  doBufferReceived(packet);
+               }
+               catch (Throwable t)
+               {
+                  RemotingConnectionImpl.log.error("Unexpected error", t);
+               }
+
+               executing = false;
+            }
+         });
+      }
+      else
+      {
+         //To prevent out of order execution if interleaving sync and async operations on same connection
+         while (executing)
+         {
+            Thread.yield();
+         }
+         
+         // Pings must always be handled out of band so we can send pings back to the client quickly
+         // otherwise they would get in the queue with everything else which might give an intolerable delay
+         doBufferReceived(packet);
+      }
+     
+      dataReceived = true;
+   }
+
+   private void doBufferReceived(final Packet packet)
+   {
+      if (interceptors != null)
+      {
+         for (final Interceptor interceptor : interceptors)
+         {
+            try
+            {
+               boolean callNext = interceptor.intercept(packet, this);
+
+               if (!callNext)
+               {
+                  return;
+               }
+            }
+            catch (final Throwable e)
+            {
+               RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
+            }
+         }
+      }
+
+      synchronized (transferLock)
+      {
+         final Channel channel = channels.get(packet.getChannelID());
+
+         if (channel != null)
+         {
+            channel.handlePacket(packet);
+         }
+      }
+   }
+
+   // Package protected
+   // ----------------------------------------------------------------------------
+
+   // Protected
+   // ------------------------------------------------------------------------------------
+
+   // Private
+   // --------------------------------------------------------------------------------------
+
+   private void removeAllChannels()
+   {
+      // We get the transfer lock first - this ensures no packets are being processed AND
+      // it's guaranteed no more packets will be processed once this method is complete
+      synchronized (transferLock)
+      {
+         channels.clear();
+      }
+   }  
+   private void callFailureListeners(final HornetQException me)
+   {
+      final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
+
+      for (final FailureListener listener : listenersClone)
+      {
+         try
+         {
+            listener.connectionFailed(me);
+         }
+         catch (final Throwable t)
+         {
+            // Failure of one listener to execute shouldn't prevent others
+            // from
+            // executing
+            RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
+         }
+      }
+   }
+
+   private void callClosingListeners()
+   {
+      final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
+
+      for (final CloseListener listener : listenersClone)
+      {
+         try
+         {
+            listener.connectionClosed();
+         }
+         catch (final Throwable t)
+         {
+            // Failure of one listener to execute shouldn't prevent others
+            // from
+            // executing
+            RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
+         }
+      }
+   }
+
+   private void internalClose()
+   {
+      // We close the underlying transport connection
+      transportConnection.close();
+
+      for (Channel channel : channels.values())
+      {
+         channel.close();
+      }
+   }
+}

Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/wireformat)

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateQueueMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateReplicationSessionMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Clebert Suconic</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateSessionMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateSessionResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/HornetQExceptionMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/MessagePacket.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.Message;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A MessagePacket

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/NullResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/PacketsConfirmedMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/Ping.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReattachSessionMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReattachSessionResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationAddMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.journal.EncodingSupport;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationAddMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationAddTXMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationAddMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationCommitMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationAddMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationCompareDataMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.journal.JournalLoadInformation;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * Message used to compare if the Journals between the live and

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationDeleteMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationAddMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationDeleteTXMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationAddMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationLargeMessageBeingMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationLargeMessageBeingMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationLargeMessageWriteMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationLargeMessageWriteMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationLargemessageEndMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationLargemessageEndMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationPageEventMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationPageWrite

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationPageWriteMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.paging.PagedMessage;
 import org.hornetq.core.paging.impl.PagedMessageImpl;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationPageWrite

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationPrepareMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A ReplicationAddMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/RollbackMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A RollbackMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionAcknowledgeMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionBindingQueryMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionBindingQueryResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,14 +11,14 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionCloseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionCommitMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A SessionCommitMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionConsumerCloseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionConsumerFlowCreditMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionContinuationMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.utils.DataConstants;
 
 /**

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionCreateConsumerMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionDeleteQueueMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionExpiredMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionForceConsumerDelivery.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionProducerCreditsMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionQueueQueryMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * 

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionQueueQueryResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.server.QueueQueryResult;
 
 /**

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionReceiveContinuationMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.utils.DataConstants;
 
 /**

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionReceiveLargeMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A SessionReceiveLargeMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionReceiveMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,14 +11,14 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.core.client.impl.ClientMessageImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.utils.DataConstants;
 
 /**

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionRequestProducerCreditsMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionSendContinuationMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * A SessionSendContinuationMessage

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionSendLargeMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionSendMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,15 +11,15 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.Message;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.utils.DataConstants;
 
 /**

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXACommitMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAEndMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAForgetMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAGetInDoubtXidsResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,7 +11,7 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -19,7 +19,8 @@
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAGetTimeoutResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAJoinMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAPrepareMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAResumeMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXARollbackMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXASetTimeoutMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXASetTimeoutResponseMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAStartMessage.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
  * permissions and limitations under the License.
  */
 
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
 
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>

Deleted: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/XidCodecSupport.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/XidCodecSupport.java	2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/XidCodecSupport.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,73 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.protocol.core.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.transaction.impl.XidImpl;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class XidCodecSupport
-{
-
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   public static void encodeXid(final Xid xid, final HornetQBuffer out)
-   {
-      out.writeInt(xid.getFormatId());
-      out.writeInt(xid.getBranchQualifier().length);
-      out.writeBytes(xid.getBranchQualifier());
-      out.writeInt(xid.getGlobalTransactionId().length);
-      out.writeBytes(xid.getGlobalTransactionId());
-   }
-
-   public static Xid decodeXid(final HornetQBuffer in)
-   {
-      int formatID = in.readInt();
-      byte[] bq = new byte[in.readInt()];
-      in.readBytes(bq);
-      byte[] gtxid = new byte[in.readInt()];
-      in.readBytes(gtxid);
-      Xid xid = new XidImpl(bq, formatID, gtxid);
-      return xid;
-   }
-
-   public static int getXidEncodeLength(final Xid xid)
-   {
-      return DataConstants.SIZE_INT * 3 + xid.getBranchQualifier().length + xid.getGlobalTransactionId().length;
-   }
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-}

Modified: trunk/src/main/org/hornetq/core/remoting/CloseListener.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/CloseListener.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/CloseListener.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,9 +13,9 @@
 package org.hornetq.core.remoting;
 
 /**
- * CloseListeners can be registered with a {@link org.hornetq.core.remoting.RemotingConnection} to get notified when the connection is closed.
+ * CloseListeners can be registered with a {@link org.hornetq.spi.core.protocol.RemotingConnection} to get notified when the connection is closed.
  * <p/>
- * {@link org.hornetq.core.remoting.RemotingConnection#addCloseListener(CloseListener)}
+ * {@link org.hornetq.spi.core.protocol.RemotingConnection#addCloseListener(CloseListener)}
  *
  * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
  */

Deleted: trunk/src/main/org/hornetq/core/remoting/ProtocolType.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/ProtocolType.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/ProtocolType.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,26 +0,0 @@
-/*
- * Copyright 2010 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.hornetq.core.remoting;
-
-/**
- * A ProtocolType
- *
- * @author Tim Fox
- *
- *
- */
-public enum ProtocolType
-{
-   CORE, STOMP, AMQP;
-}

Deleted: trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,156 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.remoting;
-
-import java.util.List;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A RemotingConnection is a connection between a client and a server.
- * <p/>
- * It allows multiple {@link org.hornetq.core.protocol.core.Channel}'s to be created and data multiplexed over them. It uses
- * and a {@link Connection} implementation and takes care of failures etc.
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- */
-public interface RemotingConnection extends BufferHandler
-{
-   /**
-    * returns the unique id of the Remoting Connection
-    *
-    * @return the id
-    */
-   Object getID();
-
-   /**
-    * returns a string representation of the remote address of this connection
-    *
-    * @return the remote address
-    */
-   String getRemoteAddress();
-
-   /**
-    * add a failure listener.
-    * <p/>
-    * The listener will be called in the event of connection failure.
-    *
-    * @param listener the listener
-    */
-   void addFailureListener(FailureListener listener);
-
-   /**
-    * remove the failure listener
-    *
-    * @param listener the lister to remove
-    * @return true if removed
-    */
-   boolean removeFailureListener(FailureListener listener);
-
-   /**
-    * add a CloseListener.
-    * <p/>
-    * This will be called in the event of the connection being closed.
-    *
-    * @param listener the listener to add
-    */
-   void addCloseListener(CloseListener listener);
-
-   /**
-    * remove a Close Listener
-    *
-    * @param listener the listener to remove
-    * @return true if removed
-    */
-   boolean removeCloseListener(CloseListener listener);
-
-   /**
-    * return all the failure listeners
-    *
-    * @return the listeners
-    */
-   List<FailureListener> getFailureListeners();
-
-   /**
-    * set the failure listeners.
-    * <p/>
-    * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
-    *
-    * @param listeners the listeners to add.
-    */
-   void setFailureListeners(List<FailureListener> listeners);
-
-   /**
-    * creates a new HornetQBuffer of the specified size.
-    *
-    * @param size the size of buffer required
-    * @return the buffer
-    */
-   HornetQBuffer createBuffer(int size);
-
-   /**
-    * called when the underlying connection fails.
-    *
-    * @param me the exception that caused the failure
-    */
-   void fail(HornetQException me);
-
-   /**
-    * destroys this connection.
-    */
-   void destroy();
-
-   /**
-    * return the underlying Connection.
-    *
-    * @return the connection
-    */
-   Connection getTransportConnection();
-
-   /**
-    * returns whether or not the Remoting Connection is a client
-    *
-    * @return true if client, false if a server
-    */
-   boolean isClient();
-
-   /**
-    * returns true if this Remoting Connection has been destroyed.
-    *
-    * @return true if destroyed, otherwise false
-    */
-   boolean isDestroyed();    
-   
-   /**
-    * Disconnect the connection, closing all channels
-    */
-   void disconnect();
-   
-   /**
-    * returns true if any data has been received since the last time this method was called.
-    *
-    * @return true if data has been received.
-    */
-   boolean checkDataReceived();
-   
-   /**
-    * flush all outstanding data from the connection.
-    */
-   void flush();
-
-}

Deleted: trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.remoting.impl;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.utils.DataConstants;
-
-/**
- * A AbstractBufferHandler
- * 
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public abstract class AbstractBufferHandler implements BufferHandler
-{
-   private static final Logger log = Logger.getLogger(AbstractBufferHandler.class);
-
-   public int isReadyToHandle(final HornetQBuffer buffer)
-   {
-      if (buffer.readableBytes() < DataConstants.SIZE_INT)
-      {
-         return -1;
-      }
-
-      int length = buffer.readInt();
-
-      if (buffer.readableBytes() < length)
-      {
-         return -1;
-      }
-
-      return length;
-   }
-}

Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,9 +21,9 @@
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.management.NotificationType;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
 import org.hornetq.core.server.management.Notification;
 import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
@@ -58,11 +58,14 @@
    private boolean paused;
 
    private NotificationService notificationService;
+   
+   private final ProtocolType protocol;
 
    public InVMAcceptor(final Map<String, Object> configuration,
                        final BufferHandler handler,
                        final ConnectionLifeCycleListener listener,
-                       final Executor threadPool)
+                       final Executor threadPool,
+                       final ProtocolType protocol)
    {
       this.handler = handler;
 
@@ -71,6 +74,8 @@
       id = ConfigurationHelper.getIntProperty(TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
 
       executorFactory = new OrderedExecutorFactory(threadPool);
+      
+      this.protocol = protocol;
    }
 
    public synchronized void start() throws Exception

Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,6 +17,7 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.AcceptorFactory;
 import org.hornetq.spi.core.remoting.BufferHandler;
@@ -34,9 +35,10 @@
                                   final BufferHandler handler,
                                   final ConnectionLifeCycleListener listener,
                                   final Executor threadPool,
-                                  final ScheduledExecutorService scheduledThreadPool)
+                                  final ScheduledExecutorService scheduledThreadPool,
+                                  final ProtocolType protocol)
    {
-      return new InVMAcceptor(configuration, handler, listener, threadPool);
+      return new InVMAcceptor(configuration, handler, listener, threadPool, protocol);
    }
 
    public Set<String> getAllowableProperties()

Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,7 +18,7 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQBuffers;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;

Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -19,7 +19,7 @@
 
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;

Deleted: trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2010 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.hornetq.core.remoting.server;
-
-import org.hornetq.core.remoting.RemotingConnection;
-
-/**
- * A ConnectionEntry
- *
- * @author Tim Fox
- *
- *
- */
-public class ConnectionEntry
-{
-   public final RemotingConnection connection;
-
-   public volatile long lastCheck;
-
-   public volatile long ttl;
-
-   public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
-   {
-      this.connection = connection;
-
-      this.lastCheck = lastCheck;
-
-      this.ttl = ttl;
-   }
-}

Deleted: trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,29 +0,0 @@
-/*
- * Copyright 2010 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.hornetq.core.remoting.server;
-
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A ProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public interface ProtocolManager
-{
-   ConnectionEntry createConnectionEntry(Connection connection);
-
-}

Modified: trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -16,8 +16,8 @@
 import java.util.Set;
 
 import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.server.HornetQComponent;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>

Modified: trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,15 +28,15 @@
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.CoreProtocolManager;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
-import org.hornetq.core.remoting.server.ConnectionEntry;
-import org.hornetq.core.remoting.server.ProtocolManager;
+import org.hornetq.core.protocol.aardvark.impl.AardvarkProtocolManagerFactory;
+import org.hornetq.core.protocol.core.impl.CoreProtocolManagerFactory;
 import org.hornetq.core.remoting.server.RemotingService;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.management.ManagementService;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolType;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.AcceptorFactory;
 import org.hornetq.spi.core.remoting.BufferHandler;
@@ -70,7 +70,7 @@
 
    private final Map<Object, ConnectionEntry> connections = new ConcurrentHashMap<Object, ConnectionEntry>();
 
-   private final BufferHandler bufferHandler = new DelegatingBufferHandler();
+   //private final BufferHandler bufferHandler = new DelegatingBufferHandler();
 
    private final Configuration config;
 
@@ -122,7 +122,8 @@
       this.threadPool = threadPool;
       this.scheduledThreadPool = scheduledThreadPool;
       
-      this.protocolMap.put(ProtocolType.CORE, new CoreProtocolManager(server, interceptors));
+      this.protocolMap.put(ProtocolType.CORE, new CoreProtocolManagerFactory().createProtocolManager(server, interceptors));
+      this.protocolMap.put(ProtocolType.AARDVARK, new AardvarkProtocolManagerFactory().createProtocolManager(server, interceptors));
    }
 
    // RemotingService implementation -------------------------------
@@ -159,12 +160,19 @@
                   continue;
                }
             }
+            
+            //TODO - allow protocol type to be configured from Configuration for each acceptor
 
+            ProtocolType protocol = hackProtocol;
+            
+            ProtocolManager manager = protocolMap.get(protocol);
+            
             Acceptor acceptor = factory.createAcceptor(info.getParams(),
-                                                       bufferHandler,
+                                                       new DelegatingBufferHandler(manager),
                                                        this,
                                                        threadPool,
-                                                       scheduledThreadPool);
+                                                       scheduledThreadPool,
+                                                       protocol);
 
             acceptors.add(acceptor);
 
@@ -193,6 +201,9 @@
 
       started = true;
    }
+   
+   //FIXME - temp hack so we can choose AARDVARK as protocol
+   public static ProtocolType hackProtocol = ProtocolType.CORE;
 
    public synchronized void freeze()
    {
@@ -376,8 +387,15 @@
 
    // Inner classes -------------------------------------------------
 
-   private final class DelegatingBufferHandler extends AbstractBufferHandler
+   private final class DelegatingBufferHandler implements BufferHandler
    {
+      private ProtocolManager manager;
+      
+      DelegatingBufferHandler(final ProtocolManager manager)
+      {
+         this.manager = manager;
+      }
+      
       public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
       {
          ConnectionEntry conn = connections.get(connectionID);
@@ -387,6 +405,11 @@
             conn.connection.bufferReceived(connectionID, buffer);
          }
       }
+
+      public int isReadyToHandle(HornetQBuffer buffer)
+      {
+         return manager.isReadyToHandle(buffer);
+      }
    }
 
    private final class FailureCheckAndFlushThread extends Thread

Modified: trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,22 +30,22 @@
 import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
 import org.hornetq.core.protocol.core.Channel;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationResponseMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
 import org.hornetq.core.replication.ReplicationEndpoint;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.LargeServerMessage;

Modified: trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -33,20 +33,20 @@
 import org.hornetq.core.protocol.core.ChannelHandler;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
 import org.hornetq.core.replication.ReplicationManager;
 import org.hornetq.utils.ExecutorFactory;
 

Modified: trunk/src/main/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/HornetQServer.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/HornetQServer.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -24,7 +24,6 @@
 import org.hornetq.core.persistence.StorageManager;
 import org.hornetq.core.postoffice.PostOffice;
 import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.remoting.server.RemotingService;
 import org.hornetq.core.replication.ReplicationEndpoint;
 import org.hornetq.core.security.Role;
@@ -35,6 +34,7 @@
 import org.hornetq.core.settings.impl.AddressSettings;
 import org.hornetq.core.transaction.ResourceManager;
 import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.spi.core.security.HornetQSecurityManager;
 import org.hornetq.utils.ExecutorFactory;
 
@@ -76,7 +76,7 @@
                                String username,
                                String password,
                                int minLargeMessageSize,
-                               CoreRemotingConnection remotingConnection,
+                               RemotingConnection remotingConnection,
                                boolean autoCommitSends,
                                boolean autoCommitAcks,
                                boolean preAcknowledge,

Modified: trunk/src/main/org/hornetq/core/server/ServerSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/ServerSession.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/ServerSession.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,6 +18,7 @@
 import javax.transaction.xa.Xid;
 
 import org.hornetq.api.core.SimpleString;
+import org.hornetq.spi.core.protocol.SessionCallback;
 
 /**
  *
@@ -85,7 +86,7 @@
 
    void deleteQueue(SimpleString name) throws Exception;
 
-   void createConsumer(long consumerID, SimpleString name, SimpleString filterString, boolean browseOnly) throws Exception;
+   void createConsumer(long consumerID, SimpleString queueName, SimpleString filterString, boolean browseOnly) throws Exception;
 
    QueueQueryResult executeQueueQuery(SimpleString name) throws Exception;
 

Deleted: trunk/src/main/org/hornetq/core/server/SessionCallback.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/SessionCallback.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/SessionCallback.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,36 +0,0 @@
-/*
- * Copyright 2009 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.hornetq.core.server;
-
-import org.hornetq.api.core.SimpleString;
-
-/**
- * A SessionCallback
- *
- * @author Tim Fox
- *
- *
- */
-public interface SessionCallback
-{
-   void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
-
-   int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
-
-   int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
-
-   int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
-   
-   void closed();
-}

Modified: trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/Bridge.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/cluster/Bridge.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -14,11 +14,11 @@
 package org.hornetq.core.server.cluster;
 
 import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.server.Consumer;
 import org.hornetq.core.server.HornetQComponent;
 import org.hornetq.core.server.Queue;
 import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A Core Bridge

Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -36,7 +36,6 @@
 import org.hornetq.core.message.impl.MessageImpl;
 import org.hornetq.core.persistence.StorageManager;
 import org.hornetq.core.postoffice.BindingType;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.server.HandleStatus;
 import org.hornetq.core.server.MessageReference;
 import org.hornetq.core.server.Queue;
@@ -46,6 +45,7 @@
 import org.hornetq.core.server.cluster.Transformer;
 import org.hornetq.core.server.management.Notification;
 import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.utils.Future;
 import org.hornetq.utils.TypedProperties;
 import org.hornetq.utils.UUID;

Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -69,7 +69,6 @@
 import org.hornetq.core.postoffice.impl.LocalQueueBinding;
 import org.hornetq.core.postoffice.impl.PostOfficeImpl;
 import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.remoting.server.RemotingService;
 import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
 import org.hornetq.core.replication.ReplicationEndpoint;
@@ -106,6 +105,7 @@
 import org.hornetq.core.transaction.impl.ResourceManagerImpl;
 import org.hornetq.core.version.Version;
 import org.hornetq.spi.core.logging.LogDelegateFactory;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.spi.core.security.HornetQSecurityManager;
 import org.hornetq.utils.ExecutorFactory;
 import org.hornetq.utils.HornetQThreadFactory;
@@ -538,7 +538,7 @@
                                       final String username,
                                       final String password,
                                       final int minLargeMessageSize,
-                                      final CoreRemotingConnection connection,
+                                      final RemotingConnection connection,
                                       final boolean autoCommitSends,
                                       final boolean autoCommitAcks,
                                       final boolean preAcknowledge,

Modified: trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -39,11 +39,11 @@
 import org.hornetq.core.server.ServerConsumer;
 import org.hornetq.core.server.ServerMessage;
 import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
 import org.hornetq.core.server.management.ManagementService;
 import org.hornetq.core.server.management.Notification;
 import org.hornetq.core.transaction.Transaction;
 import org.hornetq.core.transaction.impl.TransactionImpl;
+import org.hornetq.spi.core.protocol.SessionCallback;
 import org.hornetq.utils.Future;
 import org.hornetq.utils.TypedProperties;
 

Modified: trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,7 +21,6 @@
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.impl.MessageImpl;
 import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.protocol.core.PacketImpl;
 import org.hornetq.core.server.MessageReference;
 import org.hornetq.core.server.Queue;
 import org.hornetq.core.server.ServerMessage;
@@ -313,7 +312,7 @@
    {
       // We first set the message id - this needs to be set on the buffer since this buffer will be re-used
 
-      buffer.setLong(buffer.getInt(PacketImpl.PACKET_HEADERS_SIZE) + DataConstants.SIZE_INT, messageID);
+      buffer.setLong(buffer.getInt(MessageImpl.BUFFER_HEADER_SPACE) + DataConstants.SIZE_INT, messageID);
    }
 
 }

Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -42,7 +42,6 @@
 import org.hornetq.core.postoffice.Bindings;
 import org.hornetq.core.postoffice.PostOffice;
 import org.hornetq.core.postoffice.QueueBinding;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.remoting.CloseListener;
 import org.hornetq.core.remoting.FailureListener;
 import org.hornetq.core.security.CheckType;
@@ -57,12 +56,13 @@
 import org.hornetq.core.server.ServerConsumer;
 import org.hornetq.core.server.ServerMessage;
 import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
 import org.hornetq.core.server.management.ManagementService;
 import org.hornetq.core.server.management.Notification;
 import org.hornetq.core.transaction.ResourceManager;
 import org.hornetq.core.transaction.Transaction;
 import org.hornetq.core.transaction.impl.TransactionImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
 import org.hornetq.utils.TypedProperties;
 
 /*
@@ -99,7 +99,7 @@
 
    private final boolean strictUpdateDeliveryCount;
 
-   private CoreRemotingConnection remotingConnection;
+   private RemotingConnection remotingConnection;
 
    private final Map<Long, ServerConsumer> consumers = new ConcurrentHashMap<Long, ServerConsumer>();
 
@@ -147,7 +147,7 @@
                             final boolean preAcknowledge,
                             final boolean strictUpdateDeliveryCount,
                             final boolean xa,
-                            final CoreRemotingConnection remotingConnection,                     
+                            final RemotingConnection remotingConnection,                     
                             final StorageManager storageManager,
                             final PostOffice postOffice,
                             final ResourceManager resourceManager,
@@ -285,15 +285,15 @@
    }
 
    public void createConsumer(final long consumerID,
-                                    final SimpleString name,
+                                    final SimpleString queueName,
                                     final SimpleString filterString,
                                     final boolean browseOnly) throws Exception
    {
-      Binding binding = postOffice.getBinding(name);
+      Binding binding = postOffice.getBinding(queueName);
 
       if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE)
       {
-         throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "Queue " + name + " does not exist");
+         throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "Queue " + queueName + " does not exist");
       }
 
       securityStore.check(binding.getAddress(), CheckType.CONSUME, this);

Modified: trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -16,6 +16,7 @@
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.jboss.netty.channel.ChannelPipeline;
 import org.jboss.netty.handler.ssl.SslHandler;
@@ -44,10 +45,19 @@
 
    // Public --------------------------------------------------------
 
-   public static void addCodecFilter(final ChannelPipeline pipeline, final BufferHandler handler)
+   public static void addCodecFilter(final ProtocolType protocol, final ChannelPipeline pipeline, final BufferHandler handler)
    {
       assert pipeline != null;
-      pipeline.addLast("decoder", new HornetQFrameDecoder2());
+      
+      if (protocol == ProtocolType.CORE)
+      {
+         pipeline.addLast("decoder", new HornetQFrameDecoder2());
+      }
+      else
+      {
+         //Use the old frame decoder for other protocols
+         pipeline.addLast("decoder", new HornetQFrameDecoder(handler));
+      }
    }
 
    public static void addSSLFilter(final ChannelPipeline pipeline, final SSLContext context, final boolean client) throws Exception

Modified: trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -49,30 +49,33 @@
    @Override
    protected Object decode(final ChannelHandlerContext ctx, final Channel channel, final ChannelBuffer in) throws Exception
    {
-      // TODO - we can avoid this entirely if we maintain fragmented packets in the handler
+      log.info("dewcoding!!");
+           
       int start = in.readerIndex();
 
       int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
+      
+      log.info("length is " + length);
 
       in.readerIndex(start);
+      
+      log.info("length is 2 " + length);
 
       if (length == -1)
       {
          return null;
       }
+      
+      log.info("creating buffer");
 
-      // in.readerIndex(start + SIZE_INT);
+      ChannelBuffer buffer = in.readBytes(length);
 
-      ChannelBuffer buffer = in.readBytes(length + DataConstants.SIZE_INT);
-
-      // FIXME - we should get Netty to give us a DynamicBuffer - seems to currently give us a non resizable buffer
-
       ChannelBuffer newBuffer = ChannelBuffers.dynamicBuffer(buffer.writerIndex());
 
       newBuffer.writeBytes(buffer);
+      
+      log.info("got the buffer");
 
-      newBuffer.readInt();
-
       return newBuffer;
    }
 }

Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -31,10 +31,10 @@
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.management.NotificationType;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
 import org.hornetq.core.remoting.impl.ssl.SSLSupport;
 import org.hornetq.core.server.management.Notification;
 import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
@@ -130,17 +130,24 @@
    private NotificationService notificationService;
 
    private VirtualExecutorService bossExecutor;
+   
+   private final ProtocolType protocol;
+   
+   private boolean paused;
 
    public NettyAcceptor(final Map<String, Object> configuration,
                         final BufferHandler handler,
                         final ConnectionLifeCycleListener listener,
                         final Executor threadPool,
-                        final ScheduledExecutorService scheduledThreadPool)
+                        final ScheduledExecutorService scheduledThreadPool,
+                        final ProtocolType protocol)
    {
       this.handler = handler;
 
       this.listener = listener;
-
+      
+      this.protocol = protocol;
+      
       sslEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME,
                                                           TransportConstants.DEFAULT_SSL_ENABLED,
                                                           configuration);
@@ -281,7 +288,7 @@
                pipeline.addLast("httphandler", new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime));
             }
 
-            ChannelPipelineSupport.addCodecFilter(pipeline, handler);
+            ChannelPipelineSupport.addCodecFilter(protocol, pipeline, handler);
             pipeline.addLast("handler", new HornetQServerChannelHandler(channelGroup, handler, new Listener()));
             return pipeline;
          }
@@ -420,8 +427,6 @@
       return channelFactory != null;
    }
 
-   private boolean paused;
-
    public void pause()
    {
       if (paused)
@@ -454,7 +459,6 @@
       bossExecutor.shutdown();
       try
       {
-
          bossExecutor.awaitTermination(30, TimeUnit.SECONDS);
       }
       catch (InterruptedException e)
@@ -521,7 +525,7 @@
             throw new IllegalArgumentException("Connection already exists with id " + connection.getID());
          }
 
-         listener.connectionCreated(connection, protocol);
+         listener.connectionCreated(connection, NettyAcceptor.this.protocol);
       }
 
       public void connectionDestroyed(final Object connectionID)

Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,6 +18,7 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.AcceptorFactory;
 import org.hornetq.spi.core.remoting.BufferHandler;
@@ -34,9 +35,11 @@
                                   final BufferHandler handler,
                                   final ConnectionLifeCycleListener listener,
                                   final Executor threadPool,
-                                  final ScheduledExecutorService scheduledThreadPool)
+                                  final ScheduledExecutorService scheduledThreadPool,
+                                  final ProtocolType protocol)
    {
-      return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool);
+      return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool,
+                               protocol);
    }
 
    public Set<String> getAllowableProperties()

Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,7 +17,7 @@
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
 import org.jboss.netty.buffer.ChannelBuffers;

Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,8 +30,8 @@
 
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
 import org.hornetq.core.remoting.impl.ssl.SSLSupport;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -311,7 +311,7 @@
                pipeline.addLast("httpResponseDecoder", new HttpResponseDecoder());
                pipeline.addLast("httphandler", new HttpHandler());
             }
-            ChannelPipelineSupport.addCodecFilter(pipeline, handler);
+            ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, handler);
             pipeline.addLast("handler", new HornetQClientChannelHandler(channelGroup, handler, new Listener()));
             return pipeline;
          }

Copied: trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010 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.hornetq.spi.core.protocol;
+
+
+/**
+ * A ConnectionEntry
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class ConnectionEntry
+{
+   public final RemotingConnection connection;
+
+   public volatile long lastCheck;
+
+   public volatile long ttl;
+
+   public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
+   {
+      this.connection = connection;
+
+      this.lastCheck = lastCheck;
+
+      this.ttl = ttl;
+   }
+}

Copied: trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 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.hornetq.spi.core.protocol;
+
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A ProtocolManager
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface ProtocolManager extends BufferHandler
+{
+   ConnectionEntry createConnectionEntry(Connection connection);
+}

Copied: trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/ProtocolType.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010 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.hornetq.spi.core.protocol;
+
+/**
+ * A ProtocolType
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public enum ProtocolType
+{
+   CORE, STOMP, AMQP, AARDVARK;
+}

Copied: trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2009 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.hornetq.spi.core.protocol;
+
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A RemotingConnection is a connection between a client and a server.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface RemotingConnection extends BufferHandler
+{
+   /**
+    * returns the unique id of the Remoting Connection
+    *
+    * @return the id
+    */
+   Object getID();
+
+   /**
+    * returns a string representation of the remote address of this connection
+    *
+    * @return the remote address
+    */
+   String getRemoteAddress();
+
+   /**
+    * add a failure listener.
+    * <p/>
+    * The listener will be called in the event of connection failure.
+    *
+    * @param listener the listener
+    */
+   void addFailureListener(FailureListener listener);
+
+   /**
+    * remove the failure listener
+    *
+    * @param listener the lister to remove
+    * @return true if removed
+    */
+   boolean removeFailureListener(FailureListener listener);
+
+   /**
+    * add a CloseListener.
+    * <p/>
+    * This will be called in the event of the connection being closed.
+    *
+    * @param listener the listener to add
+    */
+   void addCloseListener(CloseListener listener);
+
+   /**
+    * remove a Close Listener
+    *
+    * @param listener the listener to remove
+    * @return true if removed
+    */
+   boolean removeCloseListener(CloseListener listener);
+
+   /**
+    * return all the failure listeners
+    *
+    * @return the listeners
+    */
+   List<FailureListener> getFailureListeners();
+
+   /**
+    * set the failure listeners.
+    * <p/>
+    * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
+    *
+    * @param listeners the listeners to add.
+    */
+   void setFailureListeners(List<FailureListener> listeners);
+
+   /**
+    * creates a new HornetQBuffer of the specified size.
+    *
+    * @param size the size of buffer required
+    * @return the buffer
+    */
+   HornetQBuffer createBuffer(int size);
+
+   /**
+    * called when the underlying connection fails.
+    *
+    * @param me the exception that caused the failure
+    */
+   void fail(HornetQException me);
+
+   /**
+    * destroys this connection.
+    */
+   void destroy();
+
+   /**
+    * return the underlying Connection.
+    *
+    * @return the connection
+    */
+   Connection getTransportConnection();
+
+   /**
+    * returns whether or not the Remoting Connection is a client
+    *
+    * @return true if client, false if a server
+    */
+   boolean isClient();
+
+   /**
+    * returns true if this Remoting Connection has been destroyed.
+    *
+    * @return true if destroyed, otherwise false
+    */
+   boolean isDestroyed();    
+   
+   /**
+    * Disconnect the connection, closing all channels
+    */
+   void disconnect();
+   
+   /**
+    * returns true if any data has been received since the last time this method was called.
+    *
+    * @return true if data has been received.
+    */
+   boolean checkDataReceived();
+   
+   /**
+    * flush all outstanding data from the connection.
+    */
+   void flush();
+
+}

Copied: trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java (from rev 8827, trunk/src/main/org/hornetq/core/server/SessionCallback.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2009 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.hornetq.spi.core.protocol;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.server.ServerMessage;
+
+/**
+ * A SessionCallback
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface SessionCallback
+{
+   void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
+
+   int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
+
+   int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
+
+   int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
+   
+   void closed();
+}

Modified: trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,6 +18,8 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 
+import org.hornetq.spi.core.protocol.ProtocolType;
+
 /**
  * A factory for creating acceptors.
  * <p/>
@@ -43,7 +45,8 @@
                            BufferHandler handler,
                            ConnectionLifeCycleListener listener,
                            Executor threadPool,
-                           ScheduledExecutorService scheduledThreadPool);
+                           ScheduledExecutorService scheduledThreadPool,
+                           ProtocolType protocol);
 
    /**
     * Returns the allowable properties for this acceptor.

Modified: trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,7 +13,7 @@
 package org.hornetq.spi.core.remoting;
 
 import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
 
 /**
  * A ConnectionLifeCycleListener is called by the remoting implementation to notify of connection events.

Copied: trunk/src/main/org/hornetq/utils/XidCodecSupport.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/wireformat/XidCodecSupport.java)
===================================================================
--- trunk/src/main/org/hornetq/utils/XidCodecSupport.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/utils/XidCodecSupport.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009 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.hornetq.utils;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.transaction.impl.XidImpl;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class XidCodecSupport
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   public static void encodeXid(final Xid xid, final HornetQBuffer out)
+   {
+      out.writeInt(xid.getFormatId());
+      out.writeInt(xid.getBranchQualifier().length);
+      out.writeBytes(xid.getBranchQualifier());
+      out.writeInt(xid.getGlobalTransactionId().length);
+      out.writeBytes(xid.getGlobalTransactionId());
+   }
+
+   public static Xid decodeXid(final HornetQBuffer in)
+   {
+      int formatID = in.readInt();
+      byte[] bq = new byte[in.readInt()];
+      in.readBytes(bq);
+      byte[] gtxid = new byte[in.readInt()];
+      in.readBytes(gtxid);
+      Xid xid = new XidImpl(bq, formatID, gtxid);
+      return xid;
+   }
+
+   public static int getXidEncodeLength(final Xid xid)
+   {
+      return DataConstants.SIZE_INT * 3 + xid.getBranchQualifier().length + xid.getGlobalTransactionId().length;
+   }
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Modified: trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,12 +25,12 @@
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.ServerMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.ServiceTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,10 +28,10 @@
 import org.hornetq.api.core.client.MessageHandler;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.Queue;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.ServiceTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -24,12 +24,12 @@
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQSession;
 import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.integration.jms.server.management.NullInitialContext;
 import org.hornetq.tests.util.UnitTestCase;
 

Modified: trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -12,12 +12,12 @@
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * 

Modified: trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -20,7 +20,7 @@
 import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.ServiceTestBase;

Modified: trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,8 +27,8 @@
 import org.hornetq.core.protocol.core.Channel;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
 import org.hornetq.core.server.HornetQServer;

Modified: trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,9 +26,9 @@
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.ServiceTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,11 +21,11 @@
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.UnitTestCase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -29,9 +29,9 @@
 import org.hornetq.api.core.client.ClientSession.BindingQuery;
 import org.hornetq.api.core.client.ClientSession.QueueQuery;
 import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.Queue;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.ServiceTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,13 +28,13 @@
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
 import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
 import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.ServiceTestBase;
 import org.hornetq.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -20,8 +20,8 @@
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>

Modified: trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -19,7 +19,7 @@
 import org.hornetq.api.core.Interceptor;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * 

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,7 +27,6 @@
 import org.hornetq.api.core.client.*;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMConnector;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.server.HornetQServer;
@@ -36,6 +35,7 @@
 import org.hornetq.core.server.cluster.QueueConfiguration;
 import org.hornetq.core.server.cluster.impl.BridgeImpl;
 import org.hornetq.integration.transports.netty.NettyConnectorFactory;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A BridgeReconnectTest

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -31,7 +31,7 @@
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.client.impl.DelegatingSession;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A MultiThreadFailoverTest

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -16,8 +16,8 @@
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.Interceptor;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A DelayInterceptor

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,8 +17,8 @@
 import org.hornetq.api.core.Interceptor;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A DelayInterceptor2

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,8 +17,8 @@
 import org.hornetq.api.core.Interceptor;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A DelayInterceptor3

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -35,10 +35,10 @@
 import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.TransportConstants;
 import org.hornetq.core.transaction.impl.XidImpl;
 import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.RandomUtil;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -22,10 +22,10 @@
 import org.hornetq.api.core.Message;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.server.cluster.MessageFlowRecord;
 import org.hornetq.core.server.cluster.impl.ClusterConnectionImpl;
 import org.hornetq.core.server.group.impl.GroupingHandlerConfiguration;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,11 +30,11 @@
 import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.config.Configuration;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.replication.impl.ReplicationEndpointImpl;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.impl.HornetQServerImpl;
 import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 
 /**
  * A PagingFailoverTest

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,8 +26,8 @@
 import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.api.core.client.SessionFailureListener;
 import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,7 +26,7 @@
 import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
 import org.hornetq.core.remoting.impl.invm.InVMConnector;
 import org.hornetq.tests.util.ServiceTestBase;
 import org.hornetq.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -31,7 +31,7 @@
 import org.hornetq.api.core.client.MessageHandler;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.jms.client.HornetQTextMessage;
 import org.hornetq.tests.util.ServiceTestBase;

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -29,11 +29,11 @@
 import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMConnector;
 import org.hornetq.core.remoting.impl.invm.InVMRegistry;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.ServiceTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,11 +25,11 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyAcceptor;
 import org.hornetq.integration.transports.netty.NettyConnector;
 import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -99,7 +99,7 @@
       conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -153,7 +153,7 @@
       conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -211,7 +211,7 @@
       conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -270,7 +270,7 @@
       conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -328,7 +328,7 @@
       conf.put(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME, 500l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -382,7 +382,7 @@
       conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
@@ -429,7 +429,7 @@
       conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
       DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
       SimpleBufferHandler2 acceptorHandler = new SimpleBufferHandler2(acceptorLatch);
-      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+      acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
       acceptor.start();
 
       BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -32,9 +32,9 @@
 import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.integration.transports.netty.NettyConnectorFactory;
 import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.JMSTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -38,7 +38,6 @@
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMRegistry;
 import org.hornetq.core.remoting.impl.invm.TransportConstants;
 import org.hornetq.core.server.HornetQServer;
@@ -46,6 +45,7 @@
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQQueue;
 import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.UnitTestCase;
 

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -37,7 +37,6 @@
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMRegistry;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
@@ -45,6 +44,7 @@
 import org.hornetq.jms.client.HornetQQueue;
 import org.hornetq.jms.client.HornetQSession;
 import org.hornetq.jms.client.HornetQTopic;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.UnitTestCase;
 

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,7 +27,7 @@
 import org.hornetq.api.jms.HornetQJMSClient;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.JMSTestBase;
 import org.hornetq.tests.util.UnitTestCase;
 

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,9 +26,9 @@
 import org.hornetq.api.jms.HornetQJMSClient;
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.JMSTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -33,11 +33,11 @@
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.CoreRemotingConnection;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
 import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.ServiceTestBase;
 
 /**

Modified: trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -59,7 +59,6 @@
 import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
 import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.replication.impl.ReplicatedJournal;
 import org.hornetq.core.replication.impl.ReplicationManagerImpl;
@@ -69,6 +68,7 @@
 import org.hornetq.core.server.impl.ServerMessageImpl;
 import org.hornetq.core.settings.HierarchicalRepository;
 import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.ServiceTestBase;
 import org.hornetq.utils.ExecutorFactory;

Modified: trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,9 +25,9 @@
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
 import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.tests.integration.remoting.PingTest;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.ServiceTestBase;

Modified: trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -36,9 +36,9 @@
 import org.hornetq.core.client.impl.ClientConsumerInternal;
 import org.hornetq.core.client.impl.ClientMessageInternal;
 import org.hornetq.core.client.impl.LargeMessageBufferImpl;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.UnitTestCase;
 

Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,10 +21,10 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyAcceptor;
 import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
@@ -73,7 +73,8 @@
                                                  handler,
                                                  listener,
                                                  Executors.newCachedThreadPool(),
-                                                 Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE));
+                                                 Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE),
+                                                 ProtocolType.CORE);
 
       Assert.assertTrue(acceptor instanceof NettyAcceptor);
    }

Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -22,10 +22,10 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyAcceptor;
 import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -86,7 +86,8 @@
                                                  handler,
                                                  listener,
                                                  Executors.newCachedThreadPool(),
-                                                 Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE));
+                                                 Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE),
+                                                 ProtocolType.CORE);
 
       acceptor.start();
       Assert.assertTrue(acceptor.isStarted());

Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -22,8 +22,8 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQBuffers;
 import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
 import org.hornetq.integration.transports.netty.NettyConnection;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
 import org.hornetq.tests.util.RandomUtil;

Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java	2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java	2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,9 +21,9 @@
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyConnector;
+import org.hornetq.spi.core.protocol.ProtocolType;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;



More information about the hornetq-commits mailing list