本文整理汇总了Java中org.eclipse.jetty.io.nio.SslConnection类的典型用法代码示例。如果您正苦于以下问题:Java SslConnection类的具体用法?Java SslConnection怎么用?Java SslConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SslConnection类属于org.eclipse.jetty.io.nio包,在下文中一共展示了SslConnection类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newEndPoint
import org.eclipse.jetty.io.nio.SslConnection; //导入依赖的package包/类
@Override
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, final SelectionKey key) throws IOException
{
WebSocketClient.WebSocketFuture holder = (WebSocketClient.WebSocketFuture)key.attachment();
int maxIdleTime = holder.getMaxIdleTime();
if (maxIdleTime < 0)
maxIdleTime = (int)getMaxIdleTime();
SelectChannelEndPoint result = new SelectChannelEndPoint(channel, selectSet, key, maxIdleTime);
AsyncEndPoint endPoint = result;
// Detect if it is SSL, and wrap the connection if so
if ("wss".equals(holder.getURI().getScheme()))
{
SSLEngine sslEngine = newSslEngine(channel);
SslConnection sslConnection = new SslConnection(sslEngine, endPoint);
endPoint.setConnection(sslConnection);
endPoint = sslConnection.getSslEndPoint();
}
AsyncConnection connection = selectSet.getManager().newConnection(channel, endPoint, holder);
endPoint.setConnection(connection);
return result;
}
示例2: newConnection
import org.eclipse.jetty.io.nio.SslConnection; //导入依赖的package包/类
@Override
protected AsyncConnection newConnection(SocketChannel channel,final AsyncEndPoint endpoint)
{
AsyncHttpConnection conn = (AsyncHttpConnection)((SslConnection)super.newConnection(channel, endpoint)).getSslEndPoint().getConnection();
ServerSessionMonitor sessionMonitor = new ServerSessionMonitor(SERVER_TYPE,
monitorService.allocateSessionId());
conn.setAssociatedObject(sessionMonitor);
this.session = sessionService.createSession();
monitorService.registerSessionMonitor(sessionMonitor, session);
return conn;
}
示例3: connectionClosed
import org.eclipse.jetty.io.nio.SslConnection; //导入依赖的package包/类
@Override
protected void connectionClosed (Connection connection) {
if (connection instanceof SslConnection) {
AsyncHttpConnection conn = (AsyncHttpConnection)((SslConnection) connection).getSslEndPoint().getConnection();
ServerSessionMonitor monitor = (ServerSessionMonitor)conn.getAssociatedObject();
if (monitor != null) {
monitorService.deregisterSessionMonitor(monitor, session);
conn.setAssociatedObject(null);
}
}
super.connectionClosed(connection);
}