Does URLConnection support TLS 1.2 out of the box?

I use a URLConnection subclass to send messages via Slack in one of my apps. Slack has emailed to say that they are removing support for TLS 1.0 and 1.1 by next February and that they have identified that my app has been sending without using TLS 1.2 within the last 7 days.

I can’t see a way to select TLS 1.2 within URLConnection but, according to the release notes, it does support TLS 1.2. Is there something I can do to force TLS 1.2 or might this just be due to my app being run on some client systems which don’t support TLS 1.2?

URLConnection uses OS implemented sockets for http requests. What that means is that it will use whatever the OS is capable of, but that does leave you at the mercy of the versions of the OS that your clients are running. For instance, Windows 7 does not enable TLSv1.2 by default, but it can be enabled by the user and, if my memory is correct, by a registry entry.

Thanks Greg. That answers my question. My installer does try to apply a Windows KB update to Windows 7 sites to enable higher TLS as our own services require TLS 1.1. However I’ve checked with our on boarding team and they say that even some Windows 8 sites need updates to enable TLS 1.1. So I guess some of these sites might be sending a message via the Slack channel before that update is applied.

@Jason Tait I’m also sending Slack notifications… but from a console app.
Since today, it’s not working anymore despite the implementation of TLS 1.2 using HTTPSSecureSocket and even transposing this ti URLConnection.
The issue does not come from the client at my opinions. I’ve tried it from my mac with last macOS update and on a Linux/Ubuntu updated server as well.
Did you get it to work since Slack impose TLS 1.2 ?

@ValryTarondeau yes were still getting Slack messages from users via my URLConnection-based class.

Doesn’t work here.
The workaround I’ve found is using CURL via the Shell object.
It works fine. The only thing is that the size of the app is increased because of the shell library needed.