Java Code Examples for org.eclipse.jetty.io.nio.SslConnection#getSslEndPoint()

The following examples show how to use org.eclipse.jetty.io.nio.SslConnection#getSslEndPoint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSocketClientFactory.java    From IoTgo_Android_App with MIT License 6 votes vote down vote up
@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;
}
 
Example 2
Source File: WebSocketClientFactory.java    From IoTgo_Android_App with MIT License 6 votes vote down vote up
@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;
}
 
Example 3
Source File: WebSocketClientFactory.java    From WebSocket-for-Android with Apache License 2.0 6 votes vote down vote up
@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;
}