Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.
This commit is contained in:
commit
3883b8cbb5
|
@ -49,13 +49,17 @@ import org.junit.Test;
|
|||
public class HostnameVerificationTest
|
||||
{
|
||||
private SslContextFactory clientSslContextFactory = new SslContextFactory();
|
||||
private Server server = new Server();
|
||||
private Server server;
|
||||
private HttpClient client;
|
||||
private NetworkConnector connector;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
QueuedThreadPool serverThreads = new QueuedThreadPool();
|
||||
serverThreads.setName("server");
|
||||
server = new Server(serverThreads);
|
||||
|
||||
SslContextFactory serverSslContextFactory = new SslContextFactory();
|
||||
serverSslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
serverSslContextFactory.setKeyStorePassword("storepwd");
|
||||
|
@ -76,10 +80,10 @@ public class HostnameVerificationTest
|
|||
clientSslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
clientSslContextFactory.setKeyStorePassword("storepwd");
|
||||
|
||||
QueuedThreadPool executor = new QueuedThreadPool();
|
||||
executor.setName(executor.getName() + "-client");
|
||||
QueuedThreadPool clientThreads = new QueuedThreadPool();
|
||||
clientThreads.setName("client");
|
||||
client = new HttpClient(clientSslContextFactory);
|
||||
client.setExecutor(executor);
|
||||
client.setExecutor(clientThreads);
|
||||
client.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -579,6 +579,7 @@ public class SslConnection extends AbstractConnection
|
|||
{
|
||||
synchronized (this)
|
||||
{
|
||||
Throwable failure = null;
|
||||
try
|
||||
{
|
||||
// Do we already have some decrypted data?
|
||||
|
@ -773,6 +774,7 @@ public class SslConnection extends AbstractConnection
|
|||
catch (SSLHandshakeException x)
|
||||
{
|
||||
notifyHandshakeFailed(_sslEngine, x);
|
||||
failure = x;
|
||||
throw x;
|
||||
}
|
||||
catch (SSLException x)
|
||||
|
@ -782,6 +784,12 @@ public class SslConnection extends AbstractConnection
|
|||
x = (SSLException)new SSLHandshakeException(x.getMessage()).initCause(x);
|
||||
notifyHandshakeFailed(_sslEngine, x);
|
||||
}
|
||||
failure = x;
|
||||
throw x;
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
failure = x;
|
||||
throw x;
|
||||
}
|
||||
finally
|
||||
|
@ -790,7 +798,7 @@ public class SslConnection extends AbstractConnection
|
|||
if (_flushRequiresFillToProgress)
|
||||
{
|
||||
_flushRequiresFillToProgress = false;
|
||||
getExecutor().execute(_runCompleteWrite);
|
||||
getExecutor().execute(failure == null ? _runCompleteWrite : new FailWriter(failure));
|
||||
}
|
||||
|
||||
if (_encryptedInput != null && !_encryptedInput.hasRemaining())
|
||||
|
@ -1132,5 +1140,28 @@ public class SslConnection extends AbstractConnection
|
|||
{
|
||||
return super.toString()+"->"+getEndPoint().toString();
|
||||
}
|
||||
|
||||
private class FailWriter extends RunnableTask
|
||||
{
|
||||
private final Throwable failure;
|
||||
|
||||
private FailWriter(Throwable failure)
|
||||
{
|
||||
super("failWrite");
|
||||
this.failure = failure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
getWriteFlusher().onFail(failure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvocationType getInvocationType()
|
||||
{
|
||||
return getWriteFlusher().getCallbackInvocationType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue