RFR: 8209137: Add ability to bind to specific local address to HTTP client [v18]

Daniel Fuchs dfuchs at openjdk.java.net
Tue May 10 13:41:49 UTC 2022


On Tue, 10 May 2022 12:37:47 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> This change proposes to implement the enhancement noted in https://bugs.openjdk.java.net/browse/JDK-8209137.
>> 
>> The change introduces a new API to allow applications to build a `java.net.http.HTTPClient` configured with a specific local address that will be used while creating `Socket`(s) for connections.
>
> Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Daniel's review suggestion - add a test to verify the behaviour of the localAddress() default method implementation on HttpClient.Builder
>  - Daniel's review suggestion - remove reference to "Internet Protocol" in javadoc

test/jdk/java/net/httpclient/HttpClientBuilderTest.java line 268:

> 266:     /**
> 267:      * Tests the {@link HttpClient,java.net.http.HttpClient.Builder#localAddress(InetAddress)} method
> 268:      * behaviour when that method is called on a builder returned by {@link HttpClient#newBuilder()}

/**
  * Tests the {@link HttpClient,java.net.http.HttpClient.Builder#localAddress(InetAddress)} method
  ```
  This `{@link` looks broken - the `HttpClient,` prefix probably need to be removed?

test/jdk/java/net/httpclient/HttpClientBuilderTest.java line 283:

> 281:      * Tests that the default method implementation of
> 282:      * {@link HttpClient,java.net.http.HttpClient.Builder#localAddress(InetAddress)} throws
> 283:      * an {@link UnsupportedOperationException}

Same remark here

-------------

PR: https://git.openjdk.java.net/jdk/pull/6690


More information about the net-dev mailing list