Java Code Examples for io.netty.util.internal.EmptyArrays#EMPTY_STRINGS

The following examples show how to use io.netty.util.internal.EmptyArrays#EMPTY_STRINGS . 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: WebSocketServerHandshaker.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor specifying the destination web socket location
 *
 * @param version
 *            the protocol version
 * @param uri
 *            URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
 *            sent to this URL.
 * @param subprotocols
 *            CSV of supported protocols. Null if sub protocols not supported.
 * @param maxFramePayloadLength
 *            Maximum length of a frame's payload
 */
protected WebSocketServerHandshaker(
        WebSocketVersion version, String uri, String subprotocols,
        int maxFramePayloadLength) {
    this.version = version;
    this.uri = uri;
    if (subprotocols != null) {
        String[] subprotocolArray = subprotocols.split(",");
        for (int i = 0; i < subprotocolArray.length; i++) {
            subprotocolArray[i] = subprotocolArray[i].trim();
        }
        this.subprotocols = subprotocolArray;
    } else {
        this.subprotocols = EmptyArrays.EMPTY_STRINGS;
    }
    this.maxFramePayloadLength = maxFramePayloadLength;
}
 
Example 2
Source File: ReferenceCountedOpenSslEngine.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
@Override
public final String[] getEnabledCipherSuites() {
    final String[] enabled;
    synchronized (this) {
        if (!isDestroyed()) {
            enabled = SSL.getCiphers(ssl);
        } else {
            return EmptyArrays.EMPTY_STRINGS;
        }
    }
    if (enabled == null) {
        return EmptyArrays.EMPTY_STRINGS;
    } else {
        synchronized (this) {
            for (int i = 0; i < enabled.length; i++) {
                String mapped = toJavaCipherSuite(enabled[i]);
                if (mapped != null) {
                    enabled[i] = mapped;
                }
            }
        }
        return enabled;
    }
}
 
Example 3
Source File: WebSocketServerHandshaker.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor specifying the destination web socket location
 *
 * @param version
 *            the protocol version
 * @param uri
 *            URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
 *            sent to this URL.
 * @param subprotocols
 *            CSV of supported protocols. Null if sub protocols not supported.
 * @param maxFramePayloadLength
 *            Maximum length of a frame's payload
 */
protected WebSocketServerHandshaker(
        WebSocketVersion version, String uri, String subprotocols,
        int maxFramePayloadLength) {
    this.version = version;
    this.uri = uri;
    if (subprotocols != null) {
        String[] subprotocolArray = StringUtil.split(subprotocols, ',');
        for (int i = 0; i < subprotocolArray.length; i++) {
            subprotocolArray[i] = subprotocolArray[i].trim();
        }
        this.subprotocols = subprotocolArray;
    } else {
        this.subprotocols = EmptyArrays.EMPTY_STRINGS;
    }
    this.maxFramePayloadLength = maxFramePayloadLength;
}
 
Example 4
Source File: ReferenceCountedOpenSslEngine.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getValueNames() {
    Map<String, Object> values = this.values;
    if (values == null || values.isEmpty()) {
        return EmptyArrays.EMPTY_STRINGS;
    }
    return values.keySet().toArray(new String[values.size()]);
}
 
Example 5
Source File: OpenSslEngine.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getEnabledCipherSuites() {
    String[] enabled = SSL.getCiphers(ssl);
    if (enabled == null) {
        return EmptyArrays.EMPTY_STRINGS;
    } else {
        for (int i = 0; i < enabled.length; i++) {
            String mapped = toJavaCipherSuite(enabled[i]);
            if (mapped != null) {
                enabled[i] = mapped;
            }
        }
        return enabled;
    }
}
 
Example 6
Source File: OpenSslEngine.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getEnabledProtocols() {
    List<String> enabled = new ArrayList<String>();
    // Seems like there is no way to explict disable SSLv2Hello in openssl so it is always enabled
    enabled.add(PROTOCOL_SSL_V2_HELLO);
    int opts = SSL.getOptions(ssl);
    if ((opts & SSL.SSL_OP_NO_TLSv1) == 0) {
        enabled.add(PROTOCOL_TLS_V1);
    }
    if ((opts & SSL.SSL_OP_NO_TLSv1_1) == 0) {
        enabled.add(PROTOCOL_TLS_V1_1);
    }
    if ((opts & SSL.SSL_OP_NO_TLSv1_2) == 0) {
        enabled.add(PROTOCOL_TLS_V1_2);
    }
    if ((opts & SSL.SSL_OP_NO_SSLv2) == 0) {
        enabled.add(PROTOCOL_SSL_V2);
    }
    if ((opts & SSL.SSL_OP_NO_SSLv3) == 0) {
        enabled.add(PROTOCOL_SSL_V3);
    }
    int size = enabled.size();
    if (size == 0) {
        return EmptyArrays.EMPTY_STRINGS;
    } else {
        return enabled.toArray(new String[size]);
    }
}
 
Example 7
Source File: OpenSslEngine.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getValueNames() {
    Map<String, Object> values = this.values;
    if (values == null || values.isEmpty()) {
        return EmptyArrays.EMPTY_STRINGS;
    }
    return values.keySet().toArray(new String[values.size()]);
}