Package io.vertx.core.http

## Class HttpConnectOptions

- java.lang.Object
- - io.vertx.core.http.HttpConnectOptions

- Direct Known Subclasses:
    `RequestOptions`

      public class HttpConnectOptions
      extends Object

  Options describing how an `HttpClient` will connect to a server.
  Author:
    Julien Viet

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `DEFAULT_CONNECT_TIMEOUT` | The default connect timeout = `-1L` (disabled)
    `static String` | `DEFAULT_HOST` | The default value for host name = `null`
    `static Integer` | `DEFAULT_PORT` | The default value for port = `null`
    `static ProxyOptions` | `DEFAULT_PROXY_OPTIONS` | The default value for proxy options = `null`
    `static SocketAddress` | `DEFAULT_SERVER` | The default value for server method = `null`
    `static Boolean` | `DEFAULT_SSL` | The default value for SSL = `null`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HttpConnectOptions()` | Default constructor
    `HttpConnectOptions​(HttpConnectOptions other)` | Copy constructor
    `HttpConnectOptions​(JsonObject json)` | Create options from JSON

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `getConnectTimeout()` |
    `String` | `getHost()` | Get the host name to be used by the client request.
    `Integer` | `getPort()` | Get the port to be used by the client request.
    `ProxyOptions` | `getProxyOptions()` | Get the proxy options override for connections
    `Address` | `getServer()` | Get the server address to be used by the client request.
    `ClientSSLOptions` | `getSslOptions()` |
    `protected void` | `init()` |
    `Boolean` | `isSsl()` |
    `HttpConnectOptions` | `setConnectTimeout​(long timeout)` | Sets the amount of time after which, if the request is not obtained from the client within the timeout period, the `Future<HttpClientRequest>` obtained from the client is failed with a `TimeoutException`.
    `HttpConnectOptions` | `setHost​(String host)` | Set the host name to be used by the client request.
    `HttpConnectOptions` | `setPort​(Integer port)` | Set the port to be used by the client request.
    `HttpConnectOptions` | `setProxyOptions​(ProxyOptions proxyOptions)` | Override the `HttpClientOptions.setProxyOptions(ProxyOptions)` proxy options for connections.
    `HttpConnectOptions` | `setServer​(Address server)` | Set the server address to be used by the client request.
    `HttpConnectOptions` | `setSsl​(Boolean ssl)` | Set whether SSL/TLS is enabled.
    `HttpConnectOptions` | `setSslOptions​(ClientSSLOptions sslOptions)` | Set the SSL options to use.
    `JsonObject` | `toJson()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_PROXY_OPTIONS

          public static final ProxyOptions DEFAULT_PROXY_OPTIONS

      The default value for proxy options = `null`

    - #### DEFAULT_SERVER

          public static final SocketAddress DEFAULT_SERVER

      The default value for server method = `null`

    - #### DEFAULT_HOST

          public static final String DEFAULT_HOST

      The default value for host name = `null`

    - #### DEFAULT_PORT

          public static final Integer DEFAULT_PORT

      The default value for port = `null`

    - #### DEFAULT_SSL

          public static final Boolean DEFAULT_SSL

      The default value for SSL = `null`

    - #### DEFAULT_CONNECT_TIMEOUT

          public static final long DEFAULT_CONNECT_TIMEOUT

      The default connect timeout = `-1L` (disabled)
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HttpConnectOptions

          public HttpConnectOptions()

      Default constructor

    - #### HttpConnectOptions

          public HttpConnectOptions​(HttpConnectOptions other)

      Copy constructor
      Parameters:
        `other` - the options to copy

    - #### HttpConnectOptions

          public HttpConnectOptions​(JsonObject json)

      Create options from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### init

          protected void init()

    - #### getProxyOptions

          public ProxyOptions getProxyOptions()

      Get the proxy options override for connections
      Returns:
        proxy options override

    - #### setProxyOptions

          public HttpConnectOptions setProxyOptions​(ProxyOptions proxyOptions)

      Override the `HttpClientOptions.setProxyOptions(ProxyOptions)` proxy options for connections.
      Parameters:
        `proxyOptions` - proxy options override object
      Returns:
        a reference to this, so the API can be used fluently

    - #### getServer

          public Address getServer()

      Get the server address to be used by the client request.
      Returns:
        the server address

    - #### setServer

          public HttpConnectOptions setServer​(Address server)

      Set the server address to be used by the client request.

      When the server address is `null`, the address will be resolved after the `host` property by the Vert.x resolver.

      Use this when you want to connect to a specific server address without name resolution.

      Returns:
        a reference to this, so the API can be used fluently

    - #### getHost

          public String getHost()

      Get the host name to be used by the client request.
      Returns:
        the host name

    - #### setHost

          public HttpConnectOptions setHost​(String host)

      Set the host name to be used by the client request.
      Returns:
        a reference to this, so the API can be used fluently

    - #### getPort

          public Integer getPort()

      Get the port to be used by the client request.
      Returns:
        the port

    - #### setPort

          public HttpConnectOptions setPort​(Integer port)

      Set the port to be used by the client request.
      Returns:
        a reference to this, so the API can be used fluently

    - #### isSsl

          public Boolean isSsl()

      Returns:
        is SSL/TLS enabled?

    - #### setSsl

          public HttpConnectOptions setSsl​(Boolean ssl)

      Set whether SSL/TLS is enabled.
      Parameters:
        `ssl` - true if enabled
      Returns:
        a reference to this, so the API can be used fluently

    - #### getSslOptions

          public ClientSSLOptions getSslOptions()

      Returns:
        the SSL options

    - #### setSslOptions

          public HttpConnectOptions setSslOptions​(ClientSSLOptions sslOptions)

      Set the SSL options to use.

      When none is provided, the client SSL options will be used instead.

      Parameters:
        `sslOptions` - the SSL options to use
      Returns:
        a reference to this, so the API can be used fluently

    - #### getConnectTimeout

          public long getConnectTimeout()

      Returns:
        the amount of time after which, if the request is not obtained from the client within the timeout period, the `Future<HttpClientRequest>` obtained from the client is failed with a `TimeoutException`

    - #### setConnectTimeout

          public HttpConnectOptions setConnectTimeout​(long timeout)

      Sets the amount of time after which, if the request is not obtained from the client within the timeout period, the `Future<HttpClientRequest>` obtained from the client is failed with a `TimeoutException`. Note this is not related to the TCP `HttpClientOptions.setConnectTimeout(int)` option, when a request is made against a pooled HTTP client, the timeout applies to the duration to obtain a connection from the pool to serve the request, the timeout might fire because the server does not respond in time or the pool is too busy to serve a request.
      Parameters:
        `timeout` - the amount of time in milliseconds.
      Returns:
        a reference to this, so the API can be used fluently

    - #### toJson

          public JsonObject toJson()