public class Connection extends Object implements MessageObserver, NonRelevantBodyObserver
Connection is an outbound TCP/IP connection, possibly managed
by a ConnectionManager.
It is symbiotic to an Exchange during the exchange's HTTP client
call, which starts in HttpClient.call(Exchange) and ends when the
HTTP response body has fully been read (or never, if
Request.isBindTargetConnectionToIncoming() is true).
The connection will be registered by the HttpClient as a
MessageObserver on the Response to get notified when the HTTP
response body has fully been read and it should deassociate itself from the
exchange.| Modifier and Type | Field and Description |
|---|---|
String |
host |
InputStream |
in |
ConnectionManager |
mgr |
OutputStream |
out |
Socket |
socket |
| Modifier and Type | Method and Description |
|---|---|
void |
bodyComplete(AbstractBody body)
Notification that the body has fully been received.
|
void |
bodyRequested(AbstractBody body) |
void |
close() |
protected void |
finalize() |
int |
getCompletedExchanges() |
String |
getHost() |
long |
getLastUse() |
int |
getMaxExchanges() |
ProxyConfiguration |
getProxyConfiguration() |
String |
getSniServerName() |
SSLProvider |
getSslProvider() |
long |
getTimeout() |
boolean |
isClosed() |
boolean |
isSame(String host,
int port) |
static Connection |
open(String host,
int port,
String localHost,
SSLProvider sslProvider,
ConnectionManager mgr,
int connectTimeout) |
static Connection |
open(String host,
int port,
String localHost,
SSLProvider sslProvider,
ConnectionManager mgr,
int connectTimeout,
String sniServername,
ProxyConfiguration proxy,
SSLProvider proxySSLProvider) |
static Connection |
open(String host,
int port,
String localHost,
SSLProvider sslProvider,
int connectTimeout) |
void |
release()
See
ConnectionManager for documentation. |
void |
setMaxExchanges(int maxExchanges) |
void |
setTimeout(long timeout) |
String |
toString() |
public final ConnectionManager mgr
public final String host
public Socket socket
public InputStream in
public OutputStream out
public static Connection open(String host, int port, String localHost, SSLProvider sslProvider, int connectTimeout) throws UnknownHostException, IOException
UnknownHostExceptionIOExceptionpublic static Connection open(String host, int port, String localHost, SSLProvider sslProvider, ConnectionManager mgr, int connectTimeout, @Nullable String sniServername, @Nullable ProxyConfiguration proxy, @Nullable SSLProvider proxySSLProvider) throws UnknownHostException, IOException
UnknownHostExceptionIOExceptionpublic static Connection open(String host, int port, String localHost, SSLProvider sslProvider, ConnectionManager mgr, int connectTimeout) throws UnknownHostException, IOException
UnknownHostExceptionIOExceptionpublic boolean isSame(String host, int port)
public void close()
throws IOException
IOExceptionprotected void finalize()
throws Throwable
public boolean isClosed()
public void release()
throws IOException
ConnectionManager for documentation.IOExceptionpublic void bodyRequested(AbstractBody body)
bodyRequested in interface MessageObserverpublic void bodyComplete(AbstractBody body)
MessageObserverMessage.addObserver(MessageObserver)), as the body may have
already been fully received when registering the observer.
This is the last event that will be fired on any MessageObserver.bodyComplete in interface MessageObserverpublic final void setTimeout(long timeout)
public final long getTimeout()
public final int getMaxExchanges()
public final void setMaxExchanges(int maxExchanges)
public final int getCompletedExchanges()
public final long getLastUse()
public String getHost()
public String getSniServerName()
public ProxyConfiguration getProxyConfiguration()
public SSLProvider getSslProvider()
Copyright © 2021. All Rights Reserved.