Buggy code:
public class ProtocolChannelClient < T extends ProtocolChannel > implements Closeable { private final boolean startedEndpoint ; private final Endpoint endpoint ; private final Registration providerRegistration ; private final URI uri ; private final ProtocolChannelFactory < T > channelFactory ; private volatile Connection connection ; private final Set < T > channels = new HashSet < T > ( ) ; private boolean closed ; private final long connectTimeout ; private ProtocolChannelClient ( final boolean startedEndpoint , final Endpoint endpoint , final Registration providerRegistration , final URI uri , final ProtocolChannelFactory < T > channelFactory , final long connectTimeout ) { } public static < T extends ProtocolChannel > ProtocolChannelClient < T > create ( final ProtocolChannelClient . Configuration < T > configuration ) throws IOException , URISyntaxException { } public Connection connect ( ) throws IOException { if ( closed ) { throw new IllegalStateException ( "Closed<seq2seq4repair_space>this<seq2seq4repair_space>client" ) ; } if ( ( connection ) != null ) { throw new IllegalStateException ( "Already<seq2seq4repair_space>connected" ) ; } <START_BUG> IoFuture < Connection > future = endpoint . connect ( uri , EMPTY , "bob" , endpoint . getName ( ) , "pass" . toCharArray ( ) ) ; <END_BUG> Status status = future . await ( connectTimeout , TimeUnit . MILLISECONDS ) ; if ( status == ( Status . WAITING ) ) { future . cancel ( ) ; throw new ConnectException ( ( ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>connect<seq2seq4repair_space>to<seq2seq4repair_space>remote<seq2seq4repair_space>server<seq2seq4repair_space>at<seq2seq4repair_space>" + ( connectTimeout ) ) + "<seq2seq4repair_space>within<seq2seq4repair_space>" ) + ( connectTimeout ) ) + "ms" ) ) ; } this . connection = future . get ( ) ; return connection ; } public T openChannel ( String channelName ) throws IOException { } public void close ( ) { } public static final class Configuration < T extends ProtocolChannel > { private static final long DEFAULT_CONNECT_TIMEOUT = 5000 ; private static final AtomicInteger COUNTER = new AtomicInteger ( ) ; private Endpoint endpoint ; private String endpointName ; private OptionMap optionMap = OptionMap . EMPTY ; private ThreadGroup group ; private String uriScheme ; private URI uri ; private ProtocolChannelFactory < T > channelFactory ; private Executor executor ; private long connectTimeout = - 1 ; private String connectTimeoutProperty ; public Configuration ( ) { } void validate ( ) { } public Endpoint getEndpoint ( ) { } public void setEndpoint ( Endpoint endpoint ) { } public void setEndpointName ( String endpointName ) { } public void setGroup ( ThreadGroup group ) { } public long getConnectTimeout ( ) { } public String getConnectTimeoutProperty ( ) { } public void setConnectTimeoutProperty ( String connectTimeoutProperty ) { } public void setConnectTimeout ( long connectTimeout ) { } public String getEndpointName ( ) { } public ThreadGroup getGroup ( ) { } public String getUriScheme ( ) { } public void setUriScheme ( String uriScheme ) { } public OptionMap getOptionMap ( ) { } public void setOptionMap ( OptionMap optionMap ) { } public URI getUri ( ) { } public void setUri ( final URI uri ) { } public Executor getExecutor ( ) { } public void setExecutor ( final Executor readExecutor ) { } public ProtocolChannelFactory < T > getChannelFactory ( ) { } public void setChannelFactory ( ProtocolChannelFactory < T > channelFactory ) { } } }

Fix:
IoFuture < Connection > future = endpoint . connect ( uri , EMPTY , "TestUser" , endpoint . getName ( ) , "TestUserPassword" . toCharArray ( ) ) ;