APIdia Launch Partner
Top Description Fields Constructors Methods
java.net

pack-priv Class HttpConnectSocketImpl

extends DelegatingSocketImpl
Class Inheritance
Imports
java.io.IOException, java.lang.reflect.Field, .Method, java.util.HashMap, .Map, .Set

Basic SocketImpl that relies on the internal HTTP protocol handler implementation to perform the HTTP tunneling and authentication. Once connected, all socket operations delegate to a platform SocketImpl.
Since
1.8

Field Summary

Modifier and TypeField and Description
private static final Method
private static final String
private InetSocketAddress
private static final Field
private static final String
private static final String
private final HashMap<Integer, Object>
private final String
private static final Field
private final Socket
Inherited from java.net.DelegatingSocketImpl:
delegate

Constructor Summary

AccessConstructor and Description
pack-priv
HttpConnectSocketImpl(Proxy proxy, SocketImpl delegate, Socket socket)

Method Summary

Modifier and TypeMethod and Description
protected void
accept(SocketImpl s)

Overrides java.net.DelegatingSocketImpl.accept.

Accepts a connection.

protected void
connect(String host, int port)

Overrides java.net.DelegatingSocketImpl.connect.

Connects this socket to the specified port on the named host.

protected void
connect(InetAddress address, int port)

Overrides java.net.DelegatingSocketImpl.connect.

Connects this socket to the specified port number on the specified host.

protected void
connect(SocketAddress endpoint, int timeout)

Overrides java.net.DelegatingSocketImpl.connect.

Connects this socket to the specified port number on the specified host.

private Socket
doTunnel(String urlString, int connectTimeout)

private void
protected InetAddress
getInetAddress()

Overrides java.net.DelegatingSocketImpl.getInetAddress.

Returns the value of this socket's address field.

protected int
getPort()

Overrides java.net.DelegatingSocketImpl.getPort.

Returns the value of this socket's port field.

protected void
listen(int backlog)

Overrides java.net.DelegatingSocketImpl.listen.

Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.

pack-priv void
public void
setOption(int opt, Object val)

Overrides java.net.DelegatingSocketImpl.setOption.

Implements java.net.SocketOptions.setOption.

Enable/disable the option specified by optID.

Inherited from java.net.DelegatingSocketImpl:
availablebindclosecreatedelegategetFileDescriptorgetInputStreamgetLocalPortgetOptiongetOptiongetOutputStreamsendUrgentDatasetOptionshutdownInputshutdownOutputsupportedOptionssupportsUrgentData

Field Detail

doTunnelingback to summary
private static final Method doTunneling
doTunnelingStrback to summary
private static final String doTunnelingStr
external_addressback to summary
private InetSocketAddress external_address
httpFieldback to summary
private static final Field httpField
httpURLClazzStrback to summary
private static final String httpURLClazzStr
netClientClazzStrback to summary
private static final String netClientClazzStr
optionsMapback to summary
private final HashMap<Integer, Object> optionsMap
serverback to summary
private final String server
serverSocketFieldback to summary
private static final Field serverSocketField
socketback to summary
private final Socket socket

Constructor Detail

HttpConnectSocketImplback to summary
pack-priv HttpConnectSocketImpl(Proxy proxy, SocketImpl delegate, Socket socket)

Method Detail

acceptback to summary
protected void accept(SocketImpl s)

Overrides java.net.DelegatingSocketImpl.accept.

Doc from java.net.SocketImpl.accept.

Accepts a connection.

Annotations
@Override
connectback to summary
protected void connect(String host, int port) throws IOException

Overrides java.net.DelegatingSocketImpl.connect.

Doc from java.net.SocketImpl.connect.

Connects this socket to the specified port on the named host.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when connecting to the remote host.
connectback to summary
protected void connect(InetAddress address, int port) throws IOException

Overrides java.net.DelegatingSocketImpl.connect.

Doc from java.net.SocketImpl.connect.

Connects this socket to the specified port number on the specified host.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when attempting a connection.
connectback to summary
protected void connect(SocketAddress endpoint, int timeout) throws IOException

Overrides java.net.DelegatingSocketImpl.connect.

Doc from java.net.SocketImpl.connect.

Connects this socket to the specified port number on the specified host. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when attempting a connection.
doTunnelback to summary
private Socket doTunnel(String urlString, int connectTimeout) throws IOException
doTunnelingback to summary
private void doTunneling(HttpURLConnection conn) throws IOException
getInetAddressback to summary
protected InetAddress getInetAddress()

Overrides java.net.DelegatingSocketImpl.getInetAddress.

Doc from java.net.SocketImpl.getInetAddress.

Returns the value of this socket's address field.

Annotations
@Override
getPortback to summary
protected int getPort()

Overrides java.net.DelegatingSocketImpl.getPort.

Doc from java.net.SocketImpl.getPort.

Returns the value of this socket's port field.

Annotations
@Override
listenback to summary
protected void listen(int backlog)

Overrides java.net.DelegatingSocketImpl.listen.

Doc from java.net.SocketImpl.listen.

Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument. If a connection indication arrives when the queue is full, the connection is refused.

Annotations
@Override
resetback to summary
pack-priv void reset()

Overrides java.net.SocketImpl.reset.

Annotations
@Override
setOptionback to summary
public void setOption(int opt, Object val) throws SocketException

Overrides java.net.DelegatingSocketImpl.setOption.

Implements java.net.SocketOptions.setOption.

Doc from java.net.SocketOptions.setOption.

Enable/disable the option specified by optID. If the option is to be enabled, and it takes an option-specific "value", this is passed in value. The actual type of value is option-specific, and it is an error to pass something that isn't of the expected type:

SocketImpl s; ... s.setOption(SO_LINGER, Integer.valueOf(10)); // OK - set SO_LINGER w/ timeout of 10 sec. s.setOption(SO_LINGER, Double.valueOf(10)); // ERROR - expects java.lang.Integer
SocketImpl s;
...
s.setOption(SO_LINGER, Integer.valueOf(10));
   // OK - set SO_LINGER w/ timeout of 10 sec.
s.setOption(SO_LINGER, Double.valueOf(10));
   // ERROR - expects java.lang.Integer
If the requested option is binary, it can be set using this method by a Boolean:
s.setOption(TCP_NODELAY, Boolean.TRUE); // OK - enables TCP_NODELAY, a binary option
s.setOption(TCP_NODELAY, Boolean.TRUE);
   // OK - enables TCP_NODELAY, a binary option
Any option can be disabled using this method with a Boolean#FALSE:
s.setOption(TCP_NODELAY, Boolean.FALSE); // OK - disables TCP_NODELAY s.setOption(SO_LINGER, Boolean.FALSE); // OK - disables SO_LINGER
s.setOption(TCP_NODELAY, Boolean.FALSE);
   // OK - disables TCP_NODELAY
s.setOption(SO_LINGER, Boolean.FALSE);
   // OK - disables SO_LINGER
For an option that has a notion of on and off, and requires a non-boolean parameter, setting its value to anything other than Boolean#FALSE implicitly enables it.
Annotations
@Override
Exceptions
SocketException:
if the option is unrecognized, the socket is closed, or some low-level error occurred