Interface Transport
- All Known Implementing Classes:
 MemoryTransport, QuicheTransport, Transport.IP, Transport.Socket, Transport.TCPIP, Transport.TCPUnix, Transport.UDPIP, Transport.UDPUnix, Transport.Unix, Transport.Wrapper
The low-level transport used by clients.
A high-level protocol such as HTTP/1.1 can be transported over a low-level protocol such as TCP/IP, Unix-Domain sockets, QUIC, shared memory, etc.
This class defines the programming interface to implement low-level protocols, and useful implementations for commonly used low-level protocols such as TCP/IP or Unix-Domain sockets.
Low-level transports may be layered; some of them maybe considered lower-level than others, but from the point of view of the high-level protocols they are all considered low-level.
For example, QUIC is typically layered on top of the UDP/IP low-level
Transport, but it may be layered on top Unix-Domain sockets,
or on top of shared memory.
As QUIC provides a reliable, ordered, stream-based transport, it may
be seen as a replacement for TCP, and high-level protocols that need
a reliable, ordered, stream-based transport may use either the non-layered
TCP/IP or the layered QUIC over UDP/IP without noticing the difference.
This makes possible to transport HTTP/1.1 over QUIC over Unix-Domain
sockets, or HTTP/2 over QUIC over shared memory, etc.
- 
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classAbstract implementation ofTransportbased on IP.static classAbstract implementation ofTransportbased on sockets.static classThe TCP/IPTransport.static classThe stream Unix-Domain socketTransport.static classThe UDP/IPTransport.static classThe datagram Unix-Domain socketTransport.static classAbstract implementation ofTransportbased on Unix-Domain sockets.static classA wrapper forTransportinstances to allow layering ofTransports. - 
Field Summary
Fields - 
Method Summary
Modifier and TypeMethodDescriptiondefault voidconnect(SocketAddress socketAddress, Map<String, Object> context) Establishes a connection to the given socket address.booleandefault SocketAddressinthashCode()default booleandefault ClientConnectionFactorynewClientConnectionFactory(ClientConnector connector, ClientConnectionFactory factory) default ConnectionnewConnection(EndPoint endPoint, Map<String, Object> context) Creates a newConnectionto be associated with the given low-levelEndPoint.default EndPointnewEndPoint(Scheduler scheduler, ManagedSelector selector, SelectableChannel selectable, SelectionKey selectionKey) ForTransports that are based on sockets, or forTransports that are layered on top of anotherTransportthat is based on sockets, this method is invoked to create a newEndPointthat wraps theSelectableChannelcreated bynewSelectableChannel().default SelectableChannelForTransports that are based on sockets, or forTransports that are layered on top of anotherTransportthat is based on sockets, this method is invoked to create a newSelectableChannelused for the socket communication.default booleanReturns whether thisTransportrequires resolution of domain names. 
- 
Field Details
- 
CONTEXT_KEY
 - 
TCP_IP
The TCP/IP
Transport. - 
UDP_IP
The UDP/IP
Transport. 
 - 
 - 
Method Details
- 
isIntrinsicallySecure
default boolean isIntrinsicallySecure()- Returns:
 - whether this 
Transportis intrinsically secure. 
 - 
requiresDomainNameResolution
default boolean requiresDomainNameResolution()Returns whether this
Transportrequires resolution of domain names.When domain name resolution is required, it must be performed by an external service, and the value returned by
getSocketAddress()is ignored, while the resolved socket address is eventually passed toconnect(SocketAddress, Map). Otherwise, domain name resolution is not required, and the value returned bygetSocketAddress()is eventually passed toconnect(SocketAddress, Map).- Returns:
 - whether this 
Transportrequires domain names resolution 
 - 
connect
Establishes a connection to the given socket address.
For
Transports thatrequire domain name resolution, this is the IP address resolved from the domain name. ForTransports that do not require domain name resolution (for example Unix-Domain sockets, or memory) this is the socket address to connect to.- Parameters:
 socketAddress- the socket address to connect tocontext- the context information to establish the connection
 - 
getSocketAddress
- Returns:
 - the socket address to connect to in case domain name resolution is not required
 
 - 
newSelectableChannel
For
Transports that are based on sockets, or forTransports that are layered on top of anotherTransportthat is based on sockets, this method is invoked to create a newSelectableChannelused for the socket communication.- Returns:
 - a new 
SelectableChannelused for the socket communication, ornullif the communication does not use sockets. - Throws:
 IOException- if theSelectableChannelcannot be created
 - 
newEndPoint
default EndPoint newEndPoint(Scheduler scheduler, ManagedSelector selector, SelectableChannel selectable, SelectionKey selectionKey) For
Transports that are based on sockets, or forTransports that are layered on top of anotherTransportthat is based on sockets, this method is invoked to create a newEndPointthat wraps theSelectableChannelcreated bynewSelectableChannel().- Parameters:
 scheduler- theSchedulerselector- theManagedSelectorselectable- theSelectableChannelselectionKey- theSelectionKey- Returns:
 - a new 
EndPoint 
 - 
newClientConnectionFactory
default ClientConnectionFactory newClientConnectionFactory(ClientConnector connector, ClientConnectionFactory factory)  - 
newConnection
Creates a new
Connectionto be associated with the given low-levelEndPoint.For non-layered
Transports such as TCP/IP, theConnectionis typically that of the high-level protocol. For layeredTransports such as QUIC, theConnectionis typically that of the layeredTransport.- Parameters:
 endPoint- theEndPointto associate theConnectiontocontext- the context information to create the connection- Returns:
 - a new 
Connection - Throws:
 IOException- if theConnectioncannot be created
 - 
hashCode
 - 
equals
 
 -