if (interactive()) {
# Only run examples in interactive R sessions
cert <- write_cert(cn = "127.0.0.1")
ser <- tls_config(server = cert$server)
cli <- tls_config(client = cert$client)
s <- socket(listen = "tls+tcp://127.0.0.1:5555", tls = ser)
s1 <- socket(dial = "tls+tcp://127.0.0.1:5555", tls = cli)
# secure TLS connection established
close(s1)
close(s)
cert
}
Run the code above in your browser using DataLab