//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void connect(SocketAddress endpoint, int timeout) throws java.io.IOException protected internal override void Connect(SocketAddress endpoint, int timeout) { if (endpoint == null || !(endpoint is InetSocketAddress)) { throw new IllegalArgumentException("Unsupported address type"); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final InetSocketAddress epoint = (InetSocketAddress)endpoint; InetSocketAddress epoint = (InetSocketAddress)endpoint; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String destHost = epoint.isUnresolved() ? epoint.getHostName() : epoint.getAddress().getHostAddress(); String destHost = epoint.Unresolved ? epoint.HostName : epoint.Address.HostAddress; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int destPort = epoint.getPort(); int destPort = epoint.Port; SecurityManager security = System.SecurityManager; if (security != null) { security.CheckConnect(destHost, destPort); } // Connect to the HTTP proxy server String urlString = "http://" + destHost + ":" + destPort; Socket httpSocket = PrivilegedDoTunnel(urlString, timeout); // Success! External_address = epoint; // close the original socket impl and release its descriptor Close(); // update the Sockets impl to the impl from the http Socket AbstractPlainSocketImpl psi = (AbstractPlainSocketImpl)httpSocket.Impl_Renamed; this.Socket.Impl_Renamed = psi; // best effort is made to try and reset options previously set //JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'entrySet' method: Set <java.util.Map_Entry <Integer, Object> > options = OptionsMap.entrySet(); try { foreach (java.util.Map_Entry <Integer, Object> entry in options) { psi.SetOption(entry.Key, entry.Value); } } // gulp! catch (IOException) { } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void setOption(int opt, Object val) throws SocketException public override void SetOption(int opt, Object val) { Impl.SetOption(opt, val); }