Search in sources :

Example 1 with BasicEndpointDetails

use of org.apache.hc.core5.http.impl.BasicEndpointDetails in project httpcomponents-core by apache.

the class BHttpConnectionBase method getEndpointDetails.

@Override
public EndpointDetails getEndpointDetails() {
    if (endpointDetails == null) {
        final SocketHolder socketHolder = this.socketHolderRef.get();
        if (socketHolder != null) {
            @SuppressWarnings("resource") final Socket socket = socketHolder.getSocket();
            Timeout socketTimeout;
            try {
                socketTimeout = Timeout.ofMilliseconds(socket.getSoTimeout());
            } catch (final SocketException e) {
                socketTimeout = Timeout.DISABLED;
            }
            endpointDetails = new BasicEndpointDetails(socket.getRemoteSocketAddress(), socket.getLocalSocketAddress(), this.connMetrics, socketTimeout);
        }
    }
    return endpointDetails;
}
Also used : SocketException(java.net.SocketException) Timeout(org.apache.hc.core5.util.Timeout) BasicEndpointDetails(org.apache.hc.core5.http.impl.BasicEndpointDetails) Socket(java.net.Socket) SSLSocket(javax.net.ssl.SSLSocket)

Aggregations

Socket (java.net.Socket)1 SocketException (java.net.SocketException)1 SSLSocket (javax.net.ssl.SSLSocket)1 BasicEndpointDetails (org.apache.hc.core5.http.impl.BasicEndpointDetails)1 Timeout (org.apache.hc.core5.util.Timeout)1