Source:
protected void receivedServerHello(ServerHello message) throws HandshakeException { usedProtocol = message.getServerVersion(); if (usedProtocol.compareTo(ProtocolVersion.VERSION_DTLS_1_2) != 0) { AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.PROTOCOL_VERSION, session.getPeer()); throw new HandshakeException("The client only supports DTLS v1.2", alert); } serverRandom = message.getRandom(); session.setSessionIdentifier(message.getSessionId()); CipherSuite cipherSuite = message.getCipherSuite(); if (!supportedCipherSuites.contains(cipherSuite)) { throw new HandshakeException( "Server wants to use not supported cipher suite " + cipherSuite, new AlertMessage( AlertLevel.FATAL, AlertDescription.ILLEGAL_PARAMETER, message.getPeer())); } session.setCipherSuite(cipherSuite); CompressionMethod compressionMethod = message.getCompressionMethod(); if (compressionMethod != CompressionMethod.NULL) { throw new HandshakeException( "Server wants to use not supported compression method " + compressionMethod, new AlertMessage( AlertLevel.FATAL, AlertDescription.ILLEGAL_PARAMETER, message.getPeer())); } session.setCompressionMethod(message.getCompressionMethod()); verifyServerHelloExtensions(message); if (connectionIdGenerator != null) { ConnectionIdExtension extension = message.getConnectionIdExtension(); if (extension != null) { ConnectionId connectionId = extension.getConnectionId(); session.setWriteConnectionId(connectionId); session.setReadConnectionId(getReadConnectionId()); } } session.setSendCertificateType(message.getClientCertificateType()); session.setSniSupported(message.hasServerNameExtension()); session.setParameterAvailable(); if (!cipherSuite.requiresServerCertificateMessage()) { states = NO_SEVER_CERTIFICATE; } }

Target:
protected void receivedServerHello(ServerHello message) throws HandshakeException { usedProtocol = message.getServerVersion(); if (usedProtocol.compareTo(ProtocolVersion.VERSION_DTLS_1_2) != 0) { AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.PROTOCOL_VERSION, session.getPeer()); throw new HandshakeException("The client only supports DTLS v1.2, not " + usedProtocol + "!", alert); } serverRandom = message.getRandom(); session.setSessionIdentifier(message.getSessionId()); CipherSuite cipherSuite = message.getCipherSuite(); if (!supportedCipherSuites.contains(cipherSuite)) { throw new HandshakeException( "Server wants to use not supported cipher suite " + cipherSuite, new AlertMessage( AlertLevel.FATAL, AlertDescription.ILLEGAL_PARAMETER, message.getPeer())); } session.setCipherSuite(cipherSuite); CompressionMethod compressionMethod = message.getCompressionMethod(); if (compressionMethod != CompressionMethod.NULL) { throw new HandshakeException( "Server wants to use not supported compression method " + compressionMethod, new AlertMessage( AlertLevel.FATAL, AlertDescription.ILLEGAL_PARAMETER, message.getPeer())); } session.setCompressionMethod(message.getCompressionMethod()); verifyServerHelloExtensions(message); if (connectionIdGenerator != null) { ConnectionIdExtension extension = message.getConnectionIdExtension(); if (extension != null) { ConnectionId connectionId = extension.getConnectionId(); session.setWriteConnectionId(connectionId); session.setReadConnectionId(getReadConnectionId()); } } session.setSendCertificateType(message.getClientCertificateType()); session.setSniSupported(message.hasServerNameExtension()); session.setParameterAvailable(); if (!cipherSuite.requiresServerCertificateMessage()) { states = NO_SEVER_CERTIFICATE; } }