You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/11/13 14:06:33 UTC
svn commit: r1769496 [2/2] - in /httpcomponents/httpcore/trunk: ./
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/
httpcore5-testing/src/main/java/org/apache/hc/core5/testing/
httpcore5-testing/src/main/java/org/apache/hc/core5/testing/n...
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ManagedIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ManagedIOSession.java?rev=1769496&r1=1769495&r2=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ManagedIOSession.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ManagedIOSession.java Sun Nov 13 14:06:33 2016
@@ -34,17 +34,26 @@ import java.util.Queue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import javax.net.ssl.SSLContext;
+
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.net.NamedEndpoint;
+import org.apache.hc.core5.reactor.ssl.SSLBufferManagement;
import org.apache.hc.core5.reactor.ssl.SSLIOSession;
+import org.apache.hc.core5.reactor.ssl.SSLMode;
+import org.apache.hc.core5.reactor.ssl.SSLSessionInitializer;
+import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
+import org.apache.hc.core5.reactor.ssl.TlsCapable;
import org.apache.hc.core5.util.Asserts;
/**
* @since 5.0
*/
@Contract(threading = ThreadingBehavior.SAFE)
-class ManagedIOSession implements IOSession {
+class ManagedIOSession implements IOSession, TlsCapable {
+ private final NamedEndpoint namedEndpoint;
private final IOSession ioSession;
private final AtomicReference<SSLIOSession> tlsSessionRef;
private final Queue<ManagedIOSession> closedSessions;
@@ -52,7 +61,11 @@ class ManagedIOSession implements IOSess
private volatile long lastAccessTime;
- ManagedIOSession(final IOSession ioSession, final Queue<ManagedIOSession> closedSessions) {
+ ManagedIOSession(
+ final NamedEndpoint namedEndpoint,
+ final IOSession ioSession,
+ final Queue<ManagedIOSession> closedSessions) {
+ this.namedEndpoint = namedEndpoint;
this.ioSession = ioSession;
this.closedSessions = closedSessions;
this.tlsSessionRef = new AtomicReference<>(null);
@@ -89,7 +102,7 @@ class ManagedIOSession implements IOSess
final SSLIOSession tlsSession = tlsSessionRef.get();
if (tlsSession != null) {
try {
- if (tlsSession.isInitialized()) {
+ if (!tlsSession.isInitialized()) {
tlsSession.initialize();
}
handler.connected(this);
@@ -115,7 +128,9 @@ class ManagedIOSession implements IOSess
tlsSession.initialize();
}
if (tlsSession.isAppInputReady()) {
- handler.inputReady(this);
+ do {
+ handler.inputReady(this);
+ } while (tlsSession.hasInputDate());
}
tlsSession.inboundTransport();
} catch (final IOException ex) {
@@ -180,6 +195,28 @@ class ManagedIOSession implements IOSess
}
@Override
+ public void startTls(
+ final SSLContext sslContext,
+ final SSLBufferManagement sslBufferManagement,
+ final SSLSessionInitializer initializer,
+ final SSLSessionVerifier verifier) {
+ if (!tlsSessionRef.compareAndSet(null, new SSLIOSession(
+ namedEndpoint,
+ ioSession,
+ namedEndpoint != null ? SSLMode.CLIENT : SSLMode.SERVER,
+ sslContext,
+ sslBufferManagement,
+ initializer,
+ verifier))) {
+ throw new IllegalStateException("TLS already activated");
+ }
+ }
+
+ @Override
+ public boolean isTlsActive() {
+ return tlsSessionRef.get() != null;
+ }
+
public void close() {
if (closed.compareAndSet(false, true)) {
try {
@@ -222,17 +259,17 @@ class ManagedIOSession implements IOSess
@Override
public void addLast(final Command command) {
- ioSession.addLast(command);
+ getSessionImpl().addLast(command);
}
@Override
public void addFirst(final Command command) {
- ioSession.addFirst(command);
+ getSessionImpl().addFirst(command);
}
@Override
public Command getCommand() {
- return ioSession.getCommand();
+ return getSessionImpl().getCommand();
}
@Override
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequest.java?rev=1769496&r1=1769495&r2=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequest.java Sun Nov 13 14:06:33 2016
@@ -30,6 +30,8 @@ package org.apache.hc.core5.reactor;
import java.io.IOException;
import java.net.SocketAddress;
+import org.apache.hc.core5.net.NamedEndpoint;
+
/**
* SessionRequest interface represents a request to establish a new connection
* (or session) to a remote host. It can be used to monitor the status of the
@@ -42,6 +44,13 @@ import java.net.SocketAddress;
public interface SessionRequest {
/**
+ * Returns remote endpoint.
+ *
+ * @return named endpoint
+ */
+ NamedEndpoint getRemoteEndpoint();
+
+ /**
* Returns socket address of the remote host.
*
* @return socket address of the remote host
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequestImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequestImpl.java?rev=1769496&r1=1769495&r2=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequestImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/SessionRequestImpl.java Sun Nov 13 14:06:33 2016
@@ -34,6 +34,7 @@ import java.nio.channels.SelectionKey;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.util.Args;
/**
@@ -47,6 +48,7 @@ public class SessionRequestImpl implemen
private volatile boolean completed;
private volatile SelectionKey key;
+ private final NamedEndpoint remoteEndpoint;
private final SocketAddress remoteAddress;
private final SocketAddress localAddress;
private final Object attachment;
@@ -57,13 +59,14 @@ public class SessionRequestImpl implemen
private volatile IOException exception = null;
public SessionRequestImpl(
+ final NamedEndpoint remoteEndpoint,
final SocketAddress remoteAddress,
final SocketAddress localAddress,
final Object attachment,
final SessionRequestCallback callback) {
super();
- Args.notNull(remoteAddress, "Remote address");
- this.remoteAddress = remoteAddress;
+ this.remoteEndpoint = Args.notNull(remoteEndpoint, "Remote endpoint");
+ this.remoteAddress = Args.notNull(remoteAddress, "Remote address");
this.localAddress = localAddress;
this.attachment = attachment;
this.callback = callback;
@@ -71,6 +74,11 @@ public class SessionRequestImpl implemen
}
@Override
+ public NamedEndpoint getRemoteEndpoint() {
+ return this.remoteEndpoint;
+ }
+
+ @Override
public SocketAddress getRemoteAddress() {
return this.remoteAddress;
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBuffer.java?rev=1769496&r1=1769495&r2=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBuffer.java Sun Nov 13 14:06:33 2016
@@ -31,7 +31,7 @@ import java.nio.ByteBuffer;
/**
* Managed internal SSL buffer.
*/
-public interface SSLBuffer {
+interface SSLBuffer {
/**
* Allocates the resources required for this buffer, or returns the resources already allocated for this buffer.
* Unless {@link #release() } is called, multiple invokations to this method must return the same
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java (from r1769014, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/ReleasableSSLBufferManagementStrategy.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/ReleasableSSLBufferManagementStrategy.java&r1=1769014&r2=1769496&rev=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/ReleasableSSLBufferManagementStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java Sun Nov 13 14:06:33 2016
@@ -24,6 +24,7 @@
* <http://www.apache.org/>.
*
*/
+
package org.apache.hc.core5.reactor.ssl;
import java.nio.ByteBuffer;
@@ -31,22 +32,54 @@ import java.nio.ByteBuffer;
import org.apache.hc.core5.util.Args;
/**
- * A {@link SSLBufferManagementStrategy} that releases the underlying buffer when deactivated.
+ * @since 5.0
*/
-public class ReleasableSSLBufferManagementStrategy implements SSLBufferManagementStrategy {
+public enum SSLBufferManagement {
+
+ STATIC,
+ DYNAMIC;
- @Override
- public SSLBuffer constructBuffer(final int size) {
- return new InternalBuffer(size);
+ static SSLBuffer create(final SSLBufferManagement mode, final int size) {
+ return mode == DYNAMIC ? new DynamicBuffer(size) : new StaticBuffer(size);
}
+ private static final class StaticBuffer implements SSLBuffer {
- private static final class InternalBuffer implements SSLBuffer {
+ private final ByteBuffer buffer;
+
+ public StaticBuffer(final int size) {
+ Args.positive(size, "size");
+ buffer = ByteBuffer.allocate(size);
+ }
+
+ @Override
+ public ByteBuffer acquire() {
+ return buffer;
+ }
+
+ @Override
+ public void release() {
+ // do nothing
+ }
+
+ @Override
+ public boolean isAcquired() {
+ return true;
+ }
+
+ @Override
+ public boolean hasData() {
+ return buffer.position() > 0;
+ }
+
+ }
+
+ private static final class DynamicBuffer implements SSLBuffer {
private ByteBuffer wrapped;
private final int length;
- public InternalBuffer(final int size) {
+ public DynamicBuffer(final int size) {
Args.positive(size, "size");
this.length = size;
}
@@ -76,4 +109,5 @@ public class ReleasableSSLBufferManageme
}
}
+
}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagement.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java?rev=1769496&r1=1769495&r2=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java Sun Nov 13 14:06:33 2016
@@ -45,7 +45,7 @@ import javax.net.ssl.SSLSession;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.EventMask;
import org.apache.hc.core5.reactor.IOEventHandler;
@@ -71,8 +71,9 @@ public class SSLIOSession implements IOS
private final SSLBuffer outEncrypted;
private final SSLBuffer inPlain;
private final SSLBuffer outPlain;
- private final InternalByteChannel channel;
- private final SSLSetupHandler handler;
+ private final ByteChannel channel;
+ private final SSLSessionInitializer initializer;
+ private final SSLSessionVerifier verifier;
private int appEventMask;
@@ -82,24 +83,25 @@ public class SSLIOSession implements IOS
private volatile boolean initialized;
/**
- * Creates new instance of {@code SSLIOSession} class. The instances created uses a
- * {@link PermanentSSLBufferManagementStrategy} to manage its buffers.
+ * Creates new instance of {@code SSLIOSession} class with static SSL buffers.
*
+ * @param targetEndpoint target endpoint (applicable in client mode only). May be {@code null}.
* @param session I/O session to be decorated with the TLS/SSL capabilities.
* @param sslMode SSL mode (client or server)
- * @param host original host (applicable in client mode only)
* @param sslContext SSL context to use for this I/O session.
- * @param handler optional SSL setup handler. May be {@code null}.
+ * @param initializer optional SSL session initializer. May be {@code null}.
+ * @param verifier optional SSL session verifier. May be {@code null}.
*
- * @since 4.4
+ * @since 5.0
*/
public SSLIOSession(
+ final NamedEndpoint targetEndpoint,
final IOSession session,
final SSLMode sslMode,
- final HttpHost host,
final SSLContext sslContext,
- final SSLSetupHandler handler) {
- this(session, sslMode, host, sslContext, handler, new PermanentSSLBufferManagementStrategy());
+ final SSLSessionInitializer initializer,
+ final SSLSessionVerifier verifier) {
+ this(targetEndpoint, session, sslMode, sslContext, SSLBufferManagement.STATIC, initializer, verifier);
}
/**
@@ -107,59 +109,70 @@ public class SSLIOSession implements IOS
*
* @param session I/O session to be decorated with the TLS/SSL capabilities.
* @param sslMode SSL mode (client or server)
- * @param host original host (applicable in client mode only)
+ * @param targetEndpoint target endpoint (applicable in client mode only). May be {@code null}.
* @param sslContext SSL context to use for this I/O session.
- * @param handler optional SSL setup handler. May be {@code null}.
- * @param bufferManagementStrategy buffer management strategy
+ * @param sslBufferManagement buffer management mode
+ * @param initializer optional SSL session initializer. May be {@code null}.
+ * @param verifier optional SSL session verifier. May be {@code null}.
+ *
+ * @since 5.0
*/
public SSLIOSession(
+ final NamedEndpoint targetEndpoint,
final IOSession session,
final SSLMode sslMode,
- final HttpHost host,
final SSLContext sslContext,
- final SSLSetupHandler handler,
- final SSLBufferManagementStrategy bufferManagementStrategy) {
+ final SSLBufferManagement sslBufferManagement,
+ final SSLSessionInitializer initializer,
+ final SSLSessionVerifier verifier) {
super();
Args.notNull(session, "IO session");
Args.notNull(sslContext, "SSL context");
- Args.notNull(bufferManagementStrategy, "Buffer management strategy");
this.session = session;
this.sslMode = sslMode;
- this.appEventMask = session.getEventMask();
- this.channel = new InternalByteChannel();
- this.handler = handler;
+ this.initializer = initializer;
+ this.verifier = verifier;
- if (this.sslMode == SSLMode.CLIENT && host != null) {
- this.sslEngine = sslContext.createSSLEngine(host.getHostName(), host.getPort());
+ this.appEventMask = session.getEventMask();
+ if (this.sslMode == SSLMode.CLIENT && targetEndpoint != null) {
+ this.sslEngine = sslContext.createSSLEngine(targetEndpoint.getHostName(), targetEndpoint.getPort());
} else {
this.sslEngine = sslContext.createSSLEngine();
}
+ final SSLSession sslSession = this.sslEngine.getSession();
// Allocate buffers for network (encrypted) data
- final int netBuffersize = this.sslEngine.getSession().getPacketBufferSize();
- this.inEncrypted = bufferManagementStrategy.constructBuffer(netBuffersize);
- this.outEncrypted = bufferManagementStrategy.constructBuffer(netBuffersize);
+ final int netBufferSize = sslSession.getPacketBufferSize();
+ this.inEncrypted = SSLBufferManagement.create(sslBufferManagement, netBufferSize);
+ this.outEncrypted = SSLBufferManagement.create(sslBufferManagement, netBufferSize);
// Allocate buffers for application (unencrypted) data
- final int appBuffersize = this.sslEngine.getSession().getApplicationBufferSize();
- this.inPlain = bufferManagementStrategy.constructBuffer(appBuffersize);
- this.outPlain = bufferManagementStrategy.constructBuffer(appBuffersize);
- }
+ final int appBufferSize = sslSession.getApplicationBufferSize();
+ this.inPlain = SSLBufferManagement.create(sslBufferManagement, appBufferSize);
+ this.outPlain = SSLBufferManagement.create(sslBufferManagement, appBufferSize);
+ this.channel = new ByteChannel() {
+
+ @Override
+ public int write(final ByteBuffer src) throws IOException {
+ return SSLIOSession.this.writePlain(src);
+ }
- /**
- * Creates new instance of {@code SSLIOSession} class.
- *
- * @param session I/O session to be decorated with the TLS/SSL capabilities.
- * @param sslMode SSL mode (client or server)
- * @param sslContext SSL context to use for this I/O session.
- * @param handler optional SSL setup handler. May be {@code null}.
- */
- public SSLIOSession(
- final IOSession session,
- final SSLMode sslMode,
- final SSLContext sslContext,
- final SSLSetupHandler handler) {
- this(session, sslMode, null, sslContext, handler);
+ @Override
+ public int read(final ByteBuffer dst) throws IOException {
+ return SSLIOSession.this.readPlain(dst);
+ }
+
+ @Override
+ public void close() throws IOException {
+ SSLIOSession.this.close();
+ }
+
+ @Override
+ public boolean isOpen() {
+ return !SSLIOSession.this.isClosed();
+ }
+
+ };
}
/**
@@ -172,8 +185,8 @@ public class SSLIOSession implements IOS
/**
* Initializes the session. This method invokes the {@link
- * SSLSetupHandler#initalize(SSLEngine)} callback if an instance of
- * {@link SSLSetupHandler} was specified at the construction time.
+ * SSLSessionInitializer#initialize(SSLEngine)} callback if an instance of
+ * {@link SSLSessionInitializer} was specified at the construction time.
*
* @throws SSLException in case of a SSL protocol exception.
* @throws IllegalStateException if the session has already been initialized.
@@ -191,8 +204,8 @@ public class SSLIOSession implements IOS
this.sslEngine.setUseClientMode(false);
break;
}
- if (this.handler != null) {
- this.handler.initalize(this.sslEngine);
+ if (this.initializer != null) {
+ this.initializer.initialize(this.sslEngine);
}
this.initialized = true;
this.sslEngine.beginHandshake();
@@ -259,7 +272,7 @@ public class SSLIOSession implements IOS
// Generate outgoing handshake data
// Acquire buffers
- ByteBuffer outPlainBuf = this.outPlain.acquire();
+ final ByteBuffer outPlainBuf = this.outPlain.acquire();
final ByteBuffer outEncryptedBuf = this.outEncrypted.acquire();
// Perform operations
@@ -270,10 +283,8 @@ public class SSLIOSession implements IOS
// Release outPlain if empty
if (outPlainBuf.position() == 0) {
this.outPlain.release();
- outPlainBuf = null;
}
-
if (result.getStatus() != Status.OK) {
handshaking = false;
}
@@ -290,7 +301,6 @@ public class SSLIOSession implements IOS
result = doUnwrap(inEncryptedBuf, inPlainBuf);
inEncryptedBuf.compact();
-
try {
if (!inEncryptedBuf.hasRemaining() && result.getHandshakeStatus() == HandshakeStatus.NEED_UNWRAP) {
throw new SSLException("Input buffer is full");
@@ -324,14 +334,17 @@ public class SSLIOSession implements IOS
// to SSLEngine.wrap()/unwrap() when that call finishes a handshake.
// It is never generated by SSLEngine.getHandshakeStatus().
if (result != null && result.getHandshakeStatus() == HandshakeStatus.FINISHED) {
- if (this.handler != null) {
- this.handler.verify(this.session, this.sslEngine.getSession());
+ if (this.verifier != null) {
+ this.verifier.verify(this.session, this.sslEngine.getSession());
}
}
}
private void updateEventMask() {
// Graceful session termination
+ if (this.status == CLOSING && !this.outEncrypted.hasData()) {
+ this.sslEngine.closeOutbound();
+ }
if (this.status == CLOSING && this.sslEngine.isOutboundDone()
&& (this.endOfStream || this.sslEngine.isInboundDone())) {
this.status = CLOSED;
@@ -388,9 +401,12 @@ public class SSLIOSession implements IOS
final ByteBuffer outEncryptedBuf = this.outEncrypted.acquire();
// Perform operation
- outEncryptedBuf.flip();
- final int bytesWritten = this.session.channel().write(outEncryptedBuf);
- outEncryptedBuf.compact();
+ int bytesWritten = 0;
+ if (outEncryptedBuf.position() > 0) {
+ outEncryptedBuf.flip();
+ bytesWritten = this.session.channel().write(outEncryptedBuf);
+ outEncryptedBuf.compact();
+ }
// Release if empty
if (outEncryptedBuf.position() == 0) {
@@ -473,8 +489,7 @@ public class SSLIOSession implements IOS
}
} while (this.sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_TASK);
// Some decrypted data is available or at the end of stream
- return (this.appEventMask & SelectionKey.OP_READ) > 0
- && (this.inPlain.hasData() || (this.endOfStream && this.status == ACTIVE));
+ return this.inPlain.hasData() || (this.endOfStream && this.status == ACTIVE);
}
/**
@@ -504,6 +519,9 @@ public class SSLIOSession implements IOS
* @throws IOException in case of an I/O error.
*/
public synchronized void outboundTransport() throws IOException {
+ if (this.session.isClosed()) {
+ return;
+ }
sendEncryptedData();
doHandshake();
updateEventMask();
@@ -580,6 +598,20 @@ public class SSLIOSession implements IOS
return 0;
}
+ /**
+ * @since 5.0
+ */
+ public synchronized boolean hasInputDate() {
+ return this.inPlain.hasData();
+ }
+
+ /**
+ * @since 5.0
+ */
+ public synchronized boolean hasOutputDate() {
+ return this.outPlain.hasData();
+ }
+
@Override
public synchronized void close() {
if (this.status >= CLOSING) {
@@ -589,7 +621,6 @@ public class SSLIOSession implements IOS
if (this.session.getSocketTimeout() == 0) {
this.session.setSocketTimeout(1000);
}
- this.sslEngine.closeOutbound();
try {
updateEventMask();
} catch (CancelledKeyException ex) {
@@ -602,14 +633,13 @@ public class SSLIOSession implements IOS
if (this.status == CLOSED) {
return;
}
- this.status = CLOSED;
- this.session.shutdown();
-
this.inEncrypted.release();
this.outEncrypted.release();
this.inPlain.release();
this.outPlain.release();
+ this.status = CLOSED;
+ this.session.shutdown();
}
@Override
@@ -623,13 +653,15 @@ public class SSLIOSession implements IOS
}
@Override
- public void addLast(final Command command) {
+ public synchronized void addLast(final Command command) {
this.session.addLast(command);
+ setEvent(SelectionKey.OP_WRITE);
}
@Override
- public void addFirst(final Command command) {
+ public synchronized void addFirst(final Command command) {
this.session.addFirst(command);
+ setEvent(SelectionKey.OP_WRITE);
}
@Override
@@ -745,28 +777,4 @@ public class SSLIOSession implements IOS
return buffer.toString();
}
- private class InternalByteChannel implements ByteChannel {
-
- @Override
- public int write(final ByteBuffer src) throws IOException {
- return SSLIOSession.this.writePlain(src);
- }
-
- @Override
- public int read(final ByteBuffer dst) throws IOException {
- return SSLIOSession.this.readPlain(dst);
- }
-
- @Override
- public void close() throws IOException {
- SSLIOSession.this.close();
- }
-
- @Override
- public boolean isOpen() {
- return !SSLIOSession.this.isClosed();
- }
-
- }
-
}
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionInitializer.java (from r1769014, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagementStrategy.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionInitializer.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionInitializer.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagementStrategy.java&r1=1769014&r2=1769496&rev=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagementStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionInitializer.java Sun Nov 13 14:06:33 2016
@@ -24,19 +24,28 @@
* <http://www.apache.org/>.
*
*/
+
package org.apache.hc.core5.reactor.ssl;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLException;
+
/**
- * Encapsulates logic to manager SSL input/output buffers.
+ * Callback interface that can be used to customize various aspects of
+ * the TLS/SSl protocol.
+ *
+ * @since 4.2
*/
-public interface SSLBufferManagementStrategy {
+public interface SSLSessionInitializer {
/**
- * Creates a {@link SSLBuffer} of {@code size}.
- * @param size size of the buffer to create
- * @return constructed buffer
- * @throws IllegalArgumentException if {@code size} is not greater than {@code 0}
+ * Triggered when the SSL connection is being initialized. Custom handlers
+ * can use this callback to customize properties of the {@link SSLEngine}
+ * used to establish the SSL session.
+ *
+ * @param sslengine the SSL engine.
+ * @throws SSLException if case of SSL protocol error.
*/
- SSLBuffer constructBuffer(int size);
+ void initialize(SSLEngine sslengine) throws SSLException;
}
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java (from r1769014, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSetupHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSetupHandler.java&r1=1769014&r2=1769496&rev=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSetupHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java Sun Nov 13 14:06:33 2016
@@ -27,7 +27,6 @@
package org.apache.hc.core5.reactor.ssl;
-import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSession;
@@ -39,18 +38,7 @@ import org.apache.hc.core5.reactor.IOSes
*
* @since 4.2
*/
-public interface SSLSetupHandler {
-
- /**
- * Triggered when the SSL connection is being initialized. Custom handlers
- * can use this callback to customize properties of the {@link SSLEngine}
- * used to establish the SSL session.
- *
- * @param sslengine the SSL engine.
- * @throws SSLException if case of SSL protocol error.
- */
- //FIXME: fix type
- void initalize(SSLEngine sslengine) throws SSLException;
+public interface SSLSessionVerifier {
/**
* Triggered when the SSL connection has been established and initial SSL
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLSessionVerifier.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java (from r1769014, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagementStrategy.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagementStrategy.java&r1=1769014&r2=1769496&rev=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLBufferManagementStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java Sun Nov 13 14:06:33 2016
@@ -24,19 +24,24 @@
* <http://www.apache.org/>.
*
*/
+
package org.apache.hc.core5.reactor.ssl;
+import javax.net.ssl.SSLContext;
+
/**
- * Encapsulates logic to manager SSL input/output buffers.
+ * Represents capability to start a TLS session.
+ *
+ * @since 5.0
*/
-public interface SSLBufferManagementStrategy {
+public interface TlsCapable {
+
+ void startTls(
+ SSLContext sslContext,
+ SSLBufferManagement sslBufferManagement,
+ SSLSessionInitializer initializer,
+ SSLSessionVerifier verifier) throws UnsupportedOperationException;
- /**
- * Creates a {@link SSLBuffer} of {@code size}.
- * @param size size of the buffer to create
- * @return constructed buffer
- * @throws IllegalArgumentException if {@code size} is not greater than {@code 0}
- */
- SSLBuffer constructBuffer(int size);
+ boolean isTlsActive();
}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/TlsCapable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/nio/TestNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/nio/TestNIOConnPool.java?rev=1769496&r1=1769495&r2=1769496&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/nio/TestNIOConnPool.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/nio/TestNIOConnPool.java Sun Nov 13 14:06:33 2016
@@ -28,7 +28,6 @@ package org.apache.hc.core5.pool.nio;
import java.io.IOException;
import java.net.ConnectException;
-import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.util.Collections;
@@ -37,6 +36,8 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.apache.hc.core5.concurrent.BasicFuture;
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.pool.PoolEntry;
import org.apache.hc.core5.pool.PoolStats;
import org.apache.hc.core5.reactor.ConnectingIOReactor;
@@ -92,8 +93,8 @@ public class TestNIOConnPool {
}
@Override
- public SocketAddress resolveRemoteAddress(final String route) {
- return InetSocketAddress.createUnresolved(route, 80);
+ public NamedEndpoint resolveRemoteEndpoint(final String route) {
+ return new HttpHost(route, 80);
}
}
@@ -173,7 +174,7 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
@@ -206,7 +207,7 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getException()).thenReturn(new IOException());
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
@@ -243,7 +244,7 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
@@ -277,7 +278,7 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
@@ -314,7 +315,7 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
@SuppressWarnings("unchecked")
final SocketAddressResolver<String> addressResolver = Mockito.mock(SocketAddressResolver.class);
- Mockito.when(addressResolver.resolveRemoteAddress("somehost")).thenThrow(new UnknownHostException());
+ Mockito.when(addressResolver.resolveRemoteEndpoint("somehost")).thenThrow(new UnknownHostException());
final LocalSessionPool pool = new LocalSessionPool(ioreactor, addressResolver, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
@@ -342,12 +343,12 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
@@ -416,12 +417,12 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
@@ -475,7 +476,7 @@ public class TestNIOConnPool {
Assert.assertFalse(future9.isDone());
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry4, true);
@@ -487,7 +488,7 @@ public class TestNIOConnPool {
Assert.assertTrue(future9.isDone());
Mockito.verify(ioreactor, Mockito.times(4)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
}
@@ -515,12 +516,12 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest1);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest3, sessionRequest4, sessionRequest3);
@@ -536,12 +537,12 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future4 = pool.lease("otherhost", null);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.never()).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -567,12 +568,12 @@ public class TestNIOConnPool {
pool.release(entry2, true);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -595,12 +596,12 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future6 = pool.lease("otherhost", null);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -608,12 +609,12 @@ public class TestNIOConnPool {
pool.release(entry4, true);
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -635,12 +636,12 @@ public class TestNIOConnPool {
pool.release(entry6, true);
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.eq(new HttpHost("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -669,7 +670,7 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest3);
@@ -682,7 +683,7 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -717,7 +718,7 @@ public class TestNIOConnPool {
Assert.assertNotNull(entry4);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -734,7 +735,7 @@ public class TestNIOConnPool {
Assert.assertFalse(future5.isDone());
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -757,7 +758,7 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.eq(new HttpHost("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
@@ -767,7 +768,7 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
Mockito.verify(ioreactor, Mockito.times(1)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
@@ -787,7 +788,7 @@ public class TestNIOConnPool {
Mockito.verify(iosession1).close();
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
final PoolStats totals = pool.getTotalStats();
@@ -816,7 +817,7 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
@@ -872,7 +873,7 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
@@ -937,7 +938,7 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(NamedEndpoint.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);