Program: 96600
Project: 96600
Buggy source:
protected <T extends ConnectFuture>ConnectFuture wsnConnectInternal(ResourceAddress connectAddress,IoHandler handler,final IoSessionInitializer<T> initializer){
  final DefaultConnectFuture wsnConnectFuture=new DefaultConnectFuture();
  IoFutureListener<ConnectFuture> parentConnectListener=new IoFutureListener<ConnectFuture>(){
    @Override public void operationComplete(    ConnectFuture future){
      if (!future.isConnected()) {
        wsnConnectFuture.setException(future.getException());
      }
 else {
        IoSession httpSession=future.getSession();
        httpSession.getCloseFuture().addListener(new IoFutureListener<CloseFuture>(){
          @Override public void operationComplete(          CloseFuture future){
            HttpConnectSession httpSession=(HttpConnectSession)future.getSession();
            HttpStatus httpStatus=httpSession.getStatus();
switch (httpStatus) {
case INFO_SWITCHING_PROTOCOLS:
              doUpgrade(httpSession);
            break;
default :
          Throwable exception=new ConnectException(String.format("String_Node_Str",httpStatus.code(),httpStatus.reason())).fillInStackTrace();
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str" + exception);
        }
      wsnConnectFuture.setException(exception);
    break;
}
}
private void doUpgrade(final HttpConnectSession httpSession){
final IoSessionInitializer<? extends IoFuture> wsnSessionInitializer=WSN_SESSION_INITIALIZER_KEY.remove(httpSession);
final ConnectFuture wsnConnectFuture=WSN_CONNECT_FUTURE_KEY.get(httpSession);
final ResourceAddress wsnConnectAddress=WSN_CONNECT_ADDRESS_KEY.remove(httpSession);
UpgradeFuture upgrade=httpSession.upgrade(ioBridgeHandler);
upgrade.addListener(new IoFutureListener<UpgradeFuture>(){
  @Override public void operationComplete(  UpgradeFuture future){
    final IoSessionEx parent=(IoSessionEx)future.getSession();
    final Callable<WsnSession> createSession=new Callable<WsnSession>(){
      @Override public WsnSession call() throws Exception {
        Callable<WsnSession> wsnSessionFactory=new Callable<WsnSession>(){
          @Override public WsnSession call() throws Exception {
            final ResourceAddress localAddress=resourceAddressFactory.newResourceAddress(wsnConnectAddress,BridgeSession.LOCAL_ADDRESS.get(httpSession));
            IoBufferAllocatorEx<?> parentAllocator=parent.getBufferAllocator();
            WsBufferAllocator wsAllocator=new WsBufferAllocator(parentAllocator);
            return new WsnSession(WsnConnector.this,getProcessor(),localAddress,wsnConnectAddress,parent,wsAllocator,httpSession.getRequestURI(),null,WebSocketWireProtocol.RFC_6455);
          }
        }
;
        return newSession(wsnSessionInitializer,wsnConnectFuture,wsnSessionFactory);
      }
    }
;
    String wsAcceptHeader=httpSession.getReadHeader("String_Node_Str");
    if (wsAcceptHeader == null) {
      logger.info("String_Node_Str");
      wsnConnectFuture.setException(new Exception("String_Node_Str"));
      return;
    }
    String frameType=httpSession.getReadHeader("String_Node_Str");
    if ("String_Node_Str".equals(frameType)) {
      parent.setAttribute(ENCODING_KEY,Encoding.BINARY);
    }
 else     if ("String_Node_Str".equals(frameType)) {
      parent.setAttribute(ENCODING_KEY,Encoding.BASE64);
    }
 else {
      parent.setAttribute(ENCODING_KEY,Encoding.TEXT);
    }
    WSN_SESSION_FACTORY_KEY.set(parent,createSession);
    parent.setAttribute(WSN_CONNECT_ADDRESS_KEY,wsnConnectAddress);
  }
}
);
}
}
);
}
}
}
;
IoSessionInitializer<ConnectFuture> parentInitializer=createParentInitializer(connectAddress,handler,initializer,wsnConnectFuture);
final ResourceAddress createAddress=connectAddress.getTransport();
BridgeConnector connector=bridgeServiceFactory.newBridgeConnector(createAddress);
connector.connect(createAddress,selectConnectHandler(createAddress),parentInitializer).addListener(parentConnectListener);
return wsnConnectFuture;
}

Fixed version (ground truth):
protected <T extends ConnectFuture>ConnectFuture wsnConnectInternal(ResourceAddress connectAddress,IoHandler handler,final IoSessionInitializer<T> initializer){
  final DefaultConnectFuture wsnConnectFuture=new DefaultConnectFuture();
  IoFutureListener<ConnectFuture> parentConnectListener=new IoFutureListener<ConnectFuture>(){
    @Override public void operationComplete(    ConnectFuture future){
      if (!future.isConnected()) {
        wsnConnectFuture.setException(future.getException());
      }
 else {
        IoSession httpSession=future.getSession();
        httpSession.getCloseFuture().addListener(new IoFutureListener<CloseFuture>(){
          @Override public void operationComplete(          CloseFuture future){
            HttpConnectSession httpSession=(HttpConnectSession)future.getSession();
            HttpStatus httpStatus=httpSession.getStatus();
switch (httpStatus) {
case INFO_SWITCHING_PROTOCOLS:
              doUpgrade(httpSession);
            break;
default :
          Throwable exception=new ConnectException(String.format("String_Node_Str",httpStatus.code(),httpStatus.reason())).fillInStackTrace();
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str" + exception);
        }
      wsnConnectFuture.setException(exception);
    break;
}
}
private void doUpgrade(final HttpConnectSession httpSession){
final IoSessionInitializer<? extends IoFuture> wsnSessionInitializer=WSN_SESSION_INITIALIZER_KEY.remove(httpSession);
final ConnectFuture wsnConnectFuture=WSN_CONNECT_FUTURE_KEY.get(httpSession);
final ResourceAddress wsnConnectAddress=WSN_CONNECT_ADDRESS_KEY.remove(httpSession);
UpgradeFuture upgrade=httpSession.upgrade(ioBridgeHandler);
upgrade.addListener(new IoFutureListener<UpgradeFuture>(){
  @Override public void operationComplete(  UpgradeFuture future){
    final IoSessionEx parent=(IoSessionEx)future.getSession();
    final Callable<WsnSession> createSession=new Callable<WsnSession>(){
      @Override public WsnSession call() throws Exception {
        Callable<WsnSession> wsnSessionFactory=new Callable<WsnSession>(){
          @Override public WsnSession call() throws Exception {
            final ResourceAddress localAddress=resourceAddressFactory.newResourceAddress(wsnConnectAddress,BridgeSession.LOCAL_ADDRESS.get(httpSession));
            IoBufferAllocatorEx<?> parentAllocator=parent.getBufferAllocator();
            WsBufferAllocator wsAllocator=new WsBufferAllocator(parentAllocator);
            return new WsnSession(WsnConnector.this,getProcessor(),localAddress,wsnConnectAddress,parent,wsAllocator,httpSession.getRequestURI(),null,WebSocketWireProtocol.RFC_6455,null);
          }
        }
;
        return newSession(wsnSessionInitializer,wsnConnectFuture,wsnSessionFactory);
      }
    }
;
    String wsAcceptHeader=httpSession.getReadHeader("String_Node_Str");
    if (wsAcceptHeader == null) {
      logger.info("String_Node_Str");
      wsnConnectFuture.setException(new Exception("String_Node_Str"));
      return;
    }
    String frameType=httpSession.getReadHeader("String_Node_Str");
    if ("String_Node_Str".equals(frameType)) {
      parent.setAttribute(ENCODING_KEY,Encoding.BINARY);
    }
 else     if ("String_Node_Str".equals(frameType)) {
      parent.setAttribute(ENCODING_KEY,Encoding.BASE64);
    }
 else {
      parent.setAttribute(ENCODING_KEY,Encoding.TEXT);
    }
    WSN_SESSION_FACTORY_KEY.set(parent,createSession);
    parent.setAttribute(WSN_CONNECT_ADDRESS_KEY,wsnConnectAddress);
  }
}
);
}
}
);
}
}
}
;
IoSessionInitializer<ConnectFuture> parentInitializer=createParentInitializer(connectAddress,handler,initializer,wsnConnectFuture);
final ResourceAddress createAddress=connectAddress.getTransport();
BridgeConnector connector=bridgeServiceFactory.newBridgeConnector(createAddress);
connector.connect(createAddress,selectConnectHandler(createAddress),parentInitializer).addListener(parentConnectListener);
return wsnConnectFuture;
}