test/jdk/java/net/httpclient/offline/FixedHttpResponse.java
branchhttp-client-branch
changeset 56126 86e628130926
parent 56089 42208b2f224e
child 56139 b3d6203051df
equal deleted inserted replaced
56122:1d7d3d8f8021 56126:86e628130926
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 import javax.net.ssl.SSLParameters;
    24 import javax.net.ssl.SSLSession;
    25 import java.net.URI;
    25 import java.net.URI;
    26 import java.util.Optional;
    26 import java.util.Optional;
    27 import java.net.http.HttpClient;
    27 import java.net.http.HttpClient;
    28 import java.net.http.HttpHeaders;
    28 import java.net.http.HttpHeaders;
    29 import java.net.http.HttpRequest;
    29 import java.net.http.HttpRequest;
    36 
    36 
    37     private final int statusCode;
    37     private final int statusCode;
    38     private final HttpRequest request;
    38     private final HttpRequest request;
    39     private final HttpHeaders headers;
    39     private final HttpHeaders headers;
    40     private final T body;
    40     private final T body;
    41     private final SSLParameters sslParameters;
    41     private final SSLSession sslSession;
    42     private final URI uri;
    42     private final URI uri;
    43     private final HttpClient.Version version;
    43     private final HttpClient.Version version;
    44 
    44 
    45     public FixedHttpResponse(int statusCode,
    45     public FixedHttpResponse(int statusCode,
    46                              HttpRequest request,
    46                              HttpRequest request,
    47                              HttpHeaders headers,
    47                              HttpHeaders headers,
    48                              T body,
    48                              T body,
    49                              SSLParameters sslParameters,
    49                              SSLSession sslSession,
    50                              URI uri,
    50                              URI uri,
    51                              HttpClient.Version version) {
    51                              HttpClient.Version version) {
    52         this.statusCode = statusCode;
    52         this.statusCode = statusCode;
    53         this.request = request;
    53         this.request = request;
    54         this.headers = headers;
    54         this.headers = headers;
    55         this.body = body;
    55         this.body = body;
    56         this.sslParameters = sslParameters;
    56         this.sslSession = sslSession;
    57         this.uri = uri;
    57         this.uri = uri;
    58         this.version = version;
    58         this.version = version;
    59     }
    59     }
    60 
    60 
    61     @Override
    61     @Override
    82     public T body() {
    82     public T body() {
    83         return body;
    83         return body;
    84     }
    84     }
    85 
    85 
    86     @Override
    86     @Override
    87     public SSLParameters sslParameters() {
    87     public Optional<SSLSession> sslSession() {
    88         return sslParameters;
    88         return Optional.ofNullable(sslSession);
    89     }
    89     }
    90 
    90 
    91     @Override
    91     @Override
    92     public URI uri() {
    92     public URI uri() {
    93         return uri;
    93         return uri;