InputStream in = ssl.getInputStream();
int oldTimeout = ssl.getSoTimeout();
ssl.setSoTimeout(1000);
- byte[] b = new byte[0];
+ byte[] b = new byte[1];
listener.reset();
ssl.startHandshake();
int maxTries = 60; // 60 * 1000 = example 1 minute time out
if (log.isTraceEnabled())
log.trace("Reading for try #" + i);
try {
- in.read(b);
+ int read = in.read(b);
+ if (read > 0) {
+ // Shouldn't happen as all input should have been swallowed
+ // before trying to do the handshake. If it does, something
+ // went wrong so lets bomb out now.
+ throw new SSLException(
+ sm.getString("jsseSupport.unexpectedData"));
+ }
} catch(SSLException sslex) {
log.info(sm.getString("jsseSupport.clientCertError"), sslex);
throw sslex;