The client-side component that connects to server sockets.
ClientConnector delegates the handling of SocketChannels
to a SelectorManager, and centralizes the configuration of
necessary components such as the executor, the scheduler, etc.
ClientConnector offers a low-level API that can be used to
connect SocketChannels to listening servers via the
connect(SocketAddress, Map) method.
However, a ClientConnector instance is typically just configured and then passed to an HttpClient transport, so that applications can use high-level APIs to make HTTP requests to servers:
// Create a ClientConnector instance. ClientConnector connector = new ClientConnector(); // Configure the ClientConnector. connector.setSelectors(1); connector.setSslContextFactory(new SslContextFactory.Client()); // Pass it to the HttpClient transport. HttpClientTransport transport = new HttpClientTransportDynamic(connector); HttpClient httpClient = new HttpClient(transport); httpClient.start();
| Modifier and Type | Class and Description |
|---|---|
| protected class | |
| public static class | ClientConnector.
Configures a |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| private SocketAddress | |
| private ByteBufferPool | |
| public static final String | |
| public static final String | |
| private final ClientConnector. | |
| private boolean | |
| public static final String | |
| private Duration | |
| private Executor | |
| private Duration | |
| private static final Logger | |
| private int | |
| public static final String | |
| private boolean | |
| private boolean | |
| private Scheduler | |
| private SelectorManager | |
| private int | |
| private int | |
| private SslContextFactory. | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| protected void | |
| public void | |
| protected void | |
| protected void | doStart()
Overrides org. Starts the managed lifecycle beans in the order they were added. |
| protected void | doStop()
Overrides org. Stops the managed lifecycle beans in the reverse order they were added. |
| public static ClientConnector | Returns: a ClientConnector that connects to the given Unix-Domain paththe Unix-Domain path to connect to path)Creates a ClientConnector configured to connect via Unix-Domain sockets to the given Unix-Domain path |
| public SocketAddress | |
| public ByteBufferPool | |
| public Duration | |
| public Executor | |
| public Duration | getIdleTimeout()
Returns: the max duration for which a connection can be idle (that is, without traffic of bytes in either direction) |
| public int | |
| public boolean | |
| public Scheduler | |
| public int | |
| public int | |
| public SslContextFactory. | |
| public boolean | isConnectBlocking()
Returns: whether |
| public boolean | isIntrinsicallySecure(SocketAddress
the SocketAddress to connect to address)Returns: whether the connection to the given SocketAddress is intrinsically secure |
| public boolean | |
| public boolean | |
| protected Connection | |
| protected EndPoint | |
| protected SelectorManager | |
| protected SslContextFactory. | |
| public void | setBindAddress(SocketAddress
the socket address to bind to before the connect operation bindAddress)Sets the bind address of sockets before the connect operation. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setReuseAddress(boolean
whether rebinding is allowed with sockets in tear-down states reuseAddress)Sets whether it is allowed to bind a socket to a socket address that may be in use by another socket in tear-down state, for example in TIME_WAIT state. |
| public void | setReusePort(boolean
whether binding to same host and port is allowed reusePort)Sets whether it is allowed to bind multiple sockets to the same socket address (same host and same port). |
| public void | |
| public void | |
| public void | |
| private <T> void | |
| public void | |
| public void |