Code example for SocketPermission

0
    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);
  } 
 
  @Override public int getConnectTimeout() { 
    return client.getConnectTimeout();