}
connector.setPort(_port.getPort());
_server.addConnector(connector);
WebSocketHandler wshandler = new WebSocketHandler()
{
@Override
public WebSocket doWebSocketConnect(final HttpServletRequest request, final String protocol)
{
Principal principal = null;
if(Collections.list(request.getAttributeNames()).contains(X509_CERTIFICATES))
{
X509Certificate[] certificates =
(X509Certificate[]) request.getAttribute(X509_CERTIFICATES);
if(certificates != null && certificates.length != 0)
{
principal = certificates[0].getSubjectDN();
}
}
SocketAddress remoteAddress = new InetSocketAddress(request.getRemoteHost(), request.getRemotePort());
SocketAddress localAddress = new InetSocketAddress(request.getLocalName(), request.getLocalPort());
return AMQP_WEBSOCKET_SUBPROTOCOL.equals(protocol) ? new AmqpWebSocket(_transport, localAddress, remoteAddress, principal) : null;
}
};
_server.setHandler(wshandler);
_server.setSendServerVersion(false);
wshandler.setHandler(new AbstractHandler()
{
@Override
public void handle(final String target,
final Request baseRequest,
final HttpServletRequest request,