cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rubin <>
Subject how to set Keep-Alive , client using ssl
Date Wed, 17 Feb 2016 14:39:29 GMT
I'm creating a client with ssl certificate. 
using this code:
		 Client client =
		 HTTPConduit httpConduit = (HTTPConduit)
		 ((org.apache.cxf.endpoint.Client) client).getConduit();

		 SSLClientParameters sParams = new SSLClientParameters();
		 sParams.setTrustpass("test");//set keystore password

/*sParams is :*/

public TLSClientParameters getTLSClientParameters() {
		TLSClientParameters tlsParams = new TLSClientParameters();
		SSLContext context = getSSlContext();
		return tlsParams;

	private SSLContext getSSlContext() {
		SSLContext sslContext = null;
		try {
			String filePath = "c:/temp/";
			filePath = filePath + fileName;
			File pKeyFile = new File(filePath);
			String pKeyPassword = trustpass;
			KeyManagerFactory keyManagerFactory =
			// Depends on the format that the keystore was created (currently
			// JKS format)
			KeyStore keyStore = KeyStore.getInstance("JKS");
			// Loading the keystore from disk to object
			InputStream keyInput = new FileInputStream(pKeyFile);
			keyStore.load(keyInput, pKeyPassword.toCharArray());
			keyManagerFactory.init(keyStore, pKeyPassword.toCharArray());

			TrustManager[] trustManagers = null;

			trustManagers = getTrustedManagers();

			sslContext = SSLContext.getInstance("TLS");
			sslContext.init(keyManagerFactory.getKeyManagers(), trustManagers, new
		catch (Exception e) {
		System.out.println("> sslContext: " + sslContext);

		return sslContext;

when I'm running this client it works fine for the first call, but the other
calls failed with read time out.
when I'm waiting -stopping the code (by breakpoint), if I'm waiting till I
see this :
Keep-Alive-Timer, called close()
Keep-Alive-Timer, called closeInternal(true)
Keep-Alive-Timer, SEND TLSv1 ALERT:  warning, description = close_notify
Keep-Alive-Timer, WRITE: TLSv1 Alert, length = 32
Keep-Alive-Timer, called closeSocket(selfInitiated)

and then go on, the next call again works fine:).

it's look like that I have to increase the time out for this.

any idea about it?

thanks in advance!

View this message in context:
Sent from the cxf-user mailing list archive at

View raw message