_network = network;
_sender = sender;
Container container = new Container(_broker.getId().toString());
SubjectCreator subjectCreator = _broker.getSubjectCreator(getLocalAddress());
_endpoint = new ConnectionEndpoint(container, asSaslServerProvider(subjectCreator));
Map<Symbol,Object> serverProperties = new LinkedHashMap<Symbol, Object>();
serverProperties.put(Symbol.valueOf(ServerPropertyNames.PRODUCT), QpidProperties.getProductName());
serverProperties.put(Symbol.valueOf(ServerPropertyNames.VERSION), QpidProperties.getReleaseVersion());
serverProperties.put(Symbol.valueOf(ServerPropertyNames.QPID_BUILD), QpidProperties.getBuildVersion());
serverProperties.put(Symbol.valueOf(ServerPropertyNames.QPID_INSTANCE_NAME), _broker.getName());
_endpoint.setProperties(serverProperties);
_endpoint.setRemoteAddress(getRemoteAddress());
_connection = new Connection_1_0(_broker, _endpoint, _connectionId, _port, _transport, subjectCreator);
_endpoint.setConnectionEventListener(_connection);
_endpoint.setFrameOutputHandler(this);
_endpoint.setSaslFrameOutput(this);
_endpoint.setOnSaslComplete(new Runnable()
{
public void run()
{
if (_endpoint.isAuthenticated())
{
_sender.send(PROTOCOL_HEADER.duplicate());
_sender.flush();
}
else
{
_network.close();
}
}
});
_frameWriter = new FrameWriter(_endpoint.getDescribedTypeRegistry());
_frameHandler = new SASLFrameHandler(_endpoint);
_sender.send(HEADER.duplicate());
_sender.flush();
_endpoint.initiateSASL(subjectCreator.getMechanisms().split(" "));
}