@Override
    public final int getPort() {
        if (isDelegating()) {
            return socket.getPort();
        }

        if (peerPort != -1) {
            // Return the port that has been explicitly set in the constructor.
            return peerPort;
        }
        return super.getPort();
    }
Try to extract the peer's hostname if it's available from the endpoint address.
common/src/main/java/org/conscrypt/AbstractConscryptSocket.java