Top Description Methods
org.eclipse.jetty.client

public Interface Connection

extends Closeable
Known Direct Subinterfaces
org.eclipse.jetty.client.transport.IConnection
Known Direct Implementers
org.eclipse.jetty.client.HttpProxy.ProxyConnection
Imports
java.io.Closeable, java.net.SocketAddress, org.eclipse.jetty.util.Promise

Connection represent a connection to a Destination and allow applications to send requests via send(Request, Response.CompleteListener).

Connections are normally pooled by Destinations, but unpooled Connections may be created by applications that want to do their own connection management via Destination#newConnection(Promise) and Connection#close().

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public default SocketAddress

Returns:

the local socket address associated with the connection
getLocalSocketAddress
()

public default SocketAddress

Returns:

the remote socket address associated with the connection
getRemoteSocketAddress
()

public boolean

Returns:

whether this connection has been closed
isClosed
()

public void
send(Request
the request to send
request
,
Response.CompleteListener
the response listener
listener
)

Sends a request with an associated response listener.

Method Detail

closeback to summary
public void close()

Redeclares java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
getLocalSocketAddressback to summary
public default SocketAddress getLocalSocketAddress()
Returns:SocketAddress

the local socket address associated with the connection

getRemoteSocketAddressback to summary
public default SocketAddress getRemoteSocketAddress()
Returns:SocketAddress

the remote socket address associated with the connection

isClosedback to summary
public boolean isClosed()
Returns:boolean

whether this connection has been closed

See Also
close()
sendback to summary
public void send(Request request, Response.CompleteListener listener)

Sends a request with an associated response listener.

Request#send(Response.CompleteListener) will eventually call this method to send the request. It is exposed to allow applications to send requests via unpooled connections.

Parameters
request:Request

the request to send

listener:Response.CompleteListener

the response listener