}
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
if (reauthentication) {
for (Iterator iterator = connectionSet.iterator(); iterator.hasNext();) {
ManagedConnection managedConnection = (ManagedConnection) iterator.next();
if (managedConnections.contains(managedConnection)) {
return managedConnection;
}
}
} else {
for (Iterator iterator = connectionSet.iterator(); iterator.hasNext();) {
ManagedConnection managedConnection = (ManagedConnection) iterator.next();
// return managedConnection;
if (managedConnections.contains(managedConnection)) {
MockManagedConnection mockManagedConnection = (MockManagedConnection) managedConnection;
if ((subject == null ? mockManagedConnection.getSubject() == null : subject.equals(mockManagedConnection.getSubject())
&& (cxRequestInfo == null ? mockManagedConnection.getConnectionRequestInfo() == null : cxRequestInfo.equals(mockManagedConnection.getConnectionRequestInfo())))) {