mkyong.com mkyong.com

Java SSLSocket TLS 1.3 example

This Java 11 JEP 332 adds support for TLS 1.3 protocol. SSLSocket + TLS 1.3 An SSLSocket client with TLS1.3 protocol and TLS_AES_128_GCM_SHA256 stream cipher, to send a request to https://google.com and print the response. JavaTLS13.java package com.mkyong.java11.jep332; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import java.io.*; // Java 11 public class JavaTLS13 { private static final...

mkyong.com mkyong.com

Java - What is transient fields?

In Java, transient fields are excluded in the serialization process. In short, when we save an object into a file (serialization), all transient fields are ignored. 1. POJO + transient Review the following Person class; the salary field is transient. public class Person implements Serializable { private static final long serialVersionUID = 1L; private String name; private int age; // ignore this field ...