Scheme.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:purecloud-iot 作者:
/**
 * Creates a new scheme.
 * Whether the created scheme allows for layered connections
 * depends on the class of {@code factory}.
 *
 * @param name      the scheme name, for example "http".
 *                  The name will be converted to lowercase.
 * @param factory   the factory for creating sockets for communication
 *                  with this scheme
 * @param port      the default port for this scheme
 *
 * @deprecated (4.1)  Use {@link #Scheme(String, int, SchemeSocketFactory)}
 */
@Deprecated
public Scheme(final String name,
              final SocketFactory factory,
              final int port) {

    Args.notNull(name, "Scheme name");
    Args.notNull(factory, "Socket factory");
    Args.check(port > 0 && port <= 0xffff, "Port is invalid");

    this.name = name.toLowerCase(Locale.ENGLISH);
    if (factory instanceof LayeredSocketFactory) {
        this.socketFactory = new SchemeLayeredSocketFactoryAdaptor(
                (LayeredSocketFactory) factory);
        this.layered = true;
    } else {
        this.socketFactory = new SchemeSocketFactoryAdaptor(factory);
        this.layered = false;
    }
    this.defaultPort = port;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号