org.apache.http.conn.scheme.Scheme.resolvePort()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.http.conn.scheme.Scheme.resolvePort()方法的一些代码示例,展示了Scheme.resolvePort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheme.resolvePort()方法的具体详情如下:
包路径:org.apache.http.conn.scheme.Scheme
类名称:Scheme
方法名:resolvePort

Scheme.resolvePort介绍

[英]Resolves the correct port for this scheme. Returns the given port if it is valid, the default port otherwise.
[中]解析此方案的正确端口。如果给定端口有效,则返回该端口,否则返回默认端口。

代码示例

代码示例来源:origin: robovm/robovm

try {
  sock = lsf.createSocket
    (conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), true);
} catch (ConnectException ex) {
  throw new HttpHostConnectException(target, ex);

代码示例来源:origin: robovm/robovm

Socket connsock = plain_sf.connectSocket(sock,
  addresses[i].getHostAddress(),
  schm.resolvePort(target.getPort()),
  local, 0, params);
if (sock != connsock) {
  Socket layeredsock = layered_sf.createSocket(sock,
    target.getHostName(),
    schm.resolvePort(target.getPort()),
    true);
  if (layeredsock != sock) {

代码示例来源:origin: jgritman/httpbuilder

public int getRemotePort() {
 HttpHost host = route.getTargetHost();
 return connManager.getSchemeRegistry().getScheme(host).resolvePort(host.getPort());
}

代码示例来源:origin: org.codehaus.groovy.modules.http-builder/http-builder

public int getRemotePort() {
 HttpHost host = route.getTargetHost();
 return connManager.getSchemeRegistry().getScheme(host).resolvePort(host.getPort());
}

代码示例来源:origin: com.twilio.sdk/twilio-java-sdk

public int getRemotePort() {
  HttpHost host = route.getTargetHost();
  return connManager.getSchemeRegistry().getScheme(host).resolvePort(host.getPort());
}

代码示例来源:origin: soundcloud/java-api-wrapper

/**
 * @param proxy the proxy to use for the wrapper, or null to clear the current one.
 */
public void setProxy(URI proxy) {
  final HttpHost host;
  if (proxy != null) {
    Scheme scheme = getHttpClient()
      .getConnectionManager()
      .getSchemeRegistry()
      .getScheme(proxy.getScheme());
    host = new HttpHost(proxy.getHost(), scheme.resolvePort(proxy.getPort()), scheme.getName());
  } else {
    host = null;
  }
  getHttpClient().getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, host);
}

代码示例来源:origin: MobiVM/robovm

try {
  sock = lsf.createSocket
    (conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), true);
} catch (ConnectException ex) {
  throw new HttpHostConnectException(target, ex);

代码示例来源:origin: FlexoVM/flexovm

try {
  sock = lsf.createSocket
    (conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), true);
} catch (ConnectException ex) {
  throw new HttpHostConnectException(target, ex);

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

try {
  sock = lsf.createSocket
    (conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), true);
} catch (ConnectException ex) {
  throw new HttpHostConnectException(target, ex);

代码示例来源:origin: com.gluonhq/robovm-rt

try {
  sock = lsf.createSocket
    (conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), true);
} catch (ConnectException ex) {
  throw new HttpHostConnectException(target, ex);

代码示例来源:origin: com.hynnet/httpclient

final Scheme scheme = schemeRegistry.getScheme(target);
target = new HttpHost(target.getHostName(),
    scheme.resolvePort(target.getPort()), target.getSchemeName());

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

final Scheme scheme = schemeRegistry.getScheme(target);
target = new HttpHost(target.getHostName(),
    scheme.resolvePort(target.getPort()), target.getSchemeName());

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

final Scheme scheme = schemeRegistry.getScheme(target);
target = new HttpHost(target.getHostName(),
    scheme.resolvePort(target.getPort()), target.getSchemeName());

代码示例来源:origin: com.hynnet/httpclient

final int port = schm.resolvePort(target.getPort());
for (int i = 0; i < addresses.length; i++) {
  final InetAddress address = addresses[i];

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

final int port = schm.resolvePort(target.getPort());
for (int i = 0; i < addresses.length; i++) {
  final InetAddress address = addresses[i];

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

final int port = schm.resolvePort(target.getPort());
for (int i = 0; i < addresses.length; i++) {
  final InetAddress address = addresses[i];

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public void updateSecureConnection(
    final OperatedClientConnection conn,
    final HttpHost target,
    final HttpContext context,
    final HttpParams params) throws IOException {
  Args.notNull(conn, "Connection");
  Args.notNull(target, "Target host");
  Args.notNull(params, "Parameters");
  Asserts.check(conn.isOpen(), "Connection must be open");
  final SchemeRegistry registry = getSchemeRegistry(context);
  final Scheme schm = registry.getScheme(target.getSchemeName());
  Asserts.check(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory,
    "Socket factory must implement SchemeLayeredSocketFactory");
  final SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
  final Socket sock = lsf.createLayeredSocket(
      conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), params);
  prepareSocket(sock, context, params);
  conn.update(sock, target, lsf.isSecure(sock), params);
}

代码示例来源:origin: com.hynnet/httpclient

public void updateSecureConnection(
    final OperatedClientConnection conn,
    final HttpHost target,
    final HttpContext context,
    final HttpParams params) throws IOException {
  Args.notNull(conn, "Connection");
  Args.notNull(target, "Target host");
  Args.notNull(params, "Parameters");
  Asserts.check(conn.isOpen(), "Connection must be open");
  final SchemeRegistry registry = getSchemeRegistry(context);
  final Scheme schm = registry.getScheme(target.getSchemeName());
  Asserts.check(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory,
    "Socket factory must implement SchemeLayeredSocketFactory");
  final SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
  final Socket sock = lsf.createLayeredSocket(
      conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), params);
  prepareSocket(sock, context, params);
  conn.update(sock, target, lsf.isSecure(sock), params);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

public void updateSecureConnection(
    final OperatedClientConnection conn,
    final HttpHost target,
    final HttpContext context,
    final HttpParams params) throws IOException {
  Args.notNull(conn, "Connection");
  Args.notNull(target, "Target host");
  Args.notNull(params, "Parameters");
  Asserts.check(conn.isOpen(), "Connection must be open");
  final SchemeRegistry registry = getSchemeRegistry(context);
  final Scheme schm = registry.getScheme(target.getSchemeName());
  Asserts.check(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory,
    "Socket factory must implement SchemeLayeredSocketFactory");
  final SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
  final Socket sock = lsf.createLayeredSocket(
      conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), params);
  prepareSocket(sock, context, params);
  conn.update(sock, target, lsf.isSecure(sock), params);
}

代码示例来源:origin: Nextdoor/bender

@Override
public void updateSecureConnection(
    final OperatedClientConnection conn,
    final HttpHost target,
    final HttpContext context,
    final HttpParams params) throws IOException {
  Args.notNull(conn, "Connection");
  Args.notNull(target, "Target host");
  Args.notNull(params, "Parameters");
  Asserts.check(conn.isOpen(), "Connection must be open");
  final SchemeRegistry registry = getSchemeRegistry(context);
  final Scheme schm = registry.getScheme(target.getSchemeName());
  Asserts.check(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory,
    "Socket factory must implement SchemeLayeredSocketFactory");
  final SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
  final Socket sock = lsf.createLayeredSocket(
      conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), params);
  prepareSocket(sock, context, params);
  conn.update(sock, target, lsf.isSecure(sock), params);
}

相关文章