if(request.getUsername() == null)
{
hornetQPrincipal = connection.getDefaultHornetQPrincipal();
}
ServerSession session = server.createSession(request.getName(),
hornetQPrincipal == null?request.getUsername(): hornetQPrincipal.getUserName(),
hornetQPrincipal == null?request.getPassword(): hornetQPrincipal.getPassword(),
request.getMinLargeMessageSize(),
connection,
request.isAutoCommitSends(),
request.isAutoCommitAcks(),
request.isPreAcknowledge(),
request.isXA(),
request.getDefaultAddress(),
new CoreSessionCallback(request.getName(),
protocolManager,
channel));
session.setSessionContext(server.getStorageManager().newContext(server.getExecutorFactory().getExecutor()));
ServerSessionPacketHandler handler = new ServerSessionPacketHandler(session,
server.getStorageManager(),
channel);
channel.setHandler(handler);