Provides implementations of the {@link net.jini.jeri.Endpoint} and {@link net.jini.jeri.ServerEndpoint} abstractions that use TCP sockets as the underlying communication mechanism. Requests and responses are framed and multiplexed over TCP connections using the Jini(TM) extensible remote invocation (Jini ERI) multiplexing protocol.

A {@link net.jini.jeri.tcp.TcpEndpoint} can be used to initiate requests over a TCP connection. Each instance contains a host name string (which may be a name or an IP address) and a TCP port number, as well as an optional {@link javax.net.SocketFactory} for customizing the type of {@link java.net.Socket} instances to use. When initiating a new request, a new TCP connection is created to the host and port, using the socket factory if present, if an existing connection is not already available for use.

A {@link net.jini.jeri.tcp.TcpServerEndpoint} can be used to listen for and receive incoming requests over a TCP connection. Each instance contains a TCP port number to listen on, a host name string to use in `Endpoint` instances derived from the instance, an optional {@link javax.net.ServerSocketFactory} for customizing the type of {@link java.net.ServerSocket} instances to use, and an optional {@link javax.net.SocketFactory} to use in derived `Endpoint` instances. When listening for requests, the port is bound to listen for TCP connections, using the server socket factory if present. The {@link net.jini.jeri.tcp.TcpServerEndpoint#enumerateListenEndpoints TcpServerEndpoint.enumerateListenEndpoints} method will produce `TcpEndpoint` instances with the same host name, port, and client socket factory for client-side use (for example, to be embedded in remote proxies).

## Jini ERI multiplexing protocol mapping

`TcpEndpoint` and `TcpServerEndpoint` map, respectively, {@link net.jini.jeri.OutboundRequest} and {@link net.jini.jeri.InboundRequest} instances to distinct sessions of a Jini ERI multiplexing protocol connection. For each new request initiated, a `TcpEndpoint` starts a new session as the client of a connection to the remote endpoint. As the server of an accepted connection, a `TcpServerEndpoint` creates a new `InboundRequest` to represent each session started by the remote endpoint. Request data is transmitted as the data sent for the corresponding session by the client, and response data is transmitted as the data sent for the corresponding session by the server. TCP connections are reused by a `TcpEndpoint` when possible.

## Constraint support

`TcpEndpoint` and `TcpServerEndpoint` support the transport layer aspects of at least the following constraints:

- any {@link net.jini.core.constraint.ConnectionAbsoluteTime}
- any {@link net.jini.core.constraint.ConnectionRelativeTime}
- a {@link net.jini.core.constraint.ConstraintAlternatives} if at least one element is supported
- {@link net.jini.core.constraint.Integrity#NO Integrity.NO}
- {@link net.jini.core.constraint.Confidentiality#NO Confidentiality.NO}
- {@link net.jini.core.constraint.ClientAuthentication#NO ClientAuthentication.NO}
- {@link net.jini.core.constraint.ServerAuthentication#NO ServerAuthentication.NO}
- {@link net.jini.core.constraint.Delegation#NO Delegation.NO}
- any {@link net.jini.core.constraint.ClientMaxPrincipal}
- any {@link net.jini.core.constraint.ClientMaxPrincipalType}
- any {@link net.jini.core.constraint.ClientMinPrincipal}
- any {@link net.jini.core.constraint.ClientMinPrincipalType}
- any {@link net.jini.core.constraint.ServerMinPrincipal}
- any {@link net.jini.core.constraint.DelegationAbsoluteTime}
- any {@link net.jini.core.constraint.DelegationRelativeTime}

(Note that `ClientMaxPricipal`, `ClientMaxPrincipalType`, `ClientMinPrincipal`, `ClientMinPrincipalType`, `ServerMinPrincipal`, `DelegationAbsoluteTime`, and `DelegationRelativeTime` constraints are trivially supported if `ClientAuthentication.YES`, `ServerAuthentication.YES`, and `Delegation.YES` are not supported.) @since 2.0 @com.sun.jini.impl This implementation uses {@link net.jini.jeri.connection.ConnectionManager} and {@link net.jini.jeri.connection.ServerConnectionManager} for connection management.

## Logging

This implementation uses the {@link java.util.logging.Logger} named `net.jini.jeri.tcp.client` to log information at the following levels:

Level | Description
--- | ---
{@link com.sun.jini.logging.Levels#HANDLED HANDLED} | exceptions caught setting options on client-side sockets
{@link java.util.logging.Level#FINE FINE} | client-side socket operations (creation and close)

This implementation uses the {@link java.util.logging.Logger} named `net.jini.jeri.tcp.server` to log information at the following levels:

Level | Description
--- | ---
{@link java.util.logging.Level#INFO INFO} | exceptions accepting on server sockets
{@link com.sun.jini.logging.Levels#HANDLED HANDLED} | exceptions caught setting options on server-side sockets
{@link java.util.logging.Level#FINE FINE} | server-side socket operations (creation, accept, and close)

## System Properties

This implementation recognizes the following system properties:

- `com.sun.jini.jeri.tcp.useNIO` - This property is interpreted as a `boolean` value (see {@link java.lang.Boolean#getBoolean Boolean.getBoolean}). If `true`, then when not using a socket factory, the implementation will use {@link java.nio.channels} APIs to create sockets that have associated selectable channels; specifically:
  - a `TcpEndpoint` with no socket factory will create sockets using {@link java.nio.channels.SocketChannel#open SocketChannel.open}, and
  - a `TcpServerEndpoint` with no server socket factory will create server sockets using {@link java.nio.channels.ServerSocketChannel#open ServerSocketChannel.open}.
  Otherwise, when not using a socket factory, the implementation will create sockets that do not have channels:
  - a `TcpEndpoint` with no socket factory will create sockets using {@link java.net.Socket#Socket()}, and
  - a `TcpServerEndpoint` with no server socket factory will create server sockets using {@link java.net.ServerSocket#ServerSocket(int)}.