Code example for InetSocketAddress

Methods: getHostName, getPort

0
  @Override public final Permission getPermission() throws IOException {
    String hostName = getURL().getHost();
    int hostPort = Util.getEffectivePort(getURL());
    if (usingProxy()) { 
      InetSocketAddress proxyAddress = (InetSocketAddress) client.getProxy().address();
      hostName = proxyAddress.getHostName();
      hostPort = proxyAddress.getPort();
    } 
    return new SocketPermission(hostName + ":" + hostPort, "connect, resolve");
  } 
 
  @Override public final String getRequestProperty(String field) {
    if (field == null) {
      return null; 
    } 
    return rawRequestHeaders.get(field);
  } 
 
  @Override public void setConnectTimeout(int timeoutMillis) {
    client.setConnectTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
  }