Program: 55213
Project: 55213
Buggy source:
public ThrowingFunction<NetworkContext,TcpEventHandler,IOException> tcpEventHandlerFactory(){
  return (networkContext) -> {
    final EngineWireNetworkContext nc=(EngineWireNetworkContext)networkContext;
    if (nc.isAcceptor())     nc.wireOutPublisher(new VanillaWireOutPublisher(WireType.TEXT));
    networkContext.serverThreadingStrategy(ServerThreadingStrategy.CONCURRENT);
    final TcpEventHandler handler=new TcpEventHandler(networkContext);
    final Function<Object,TcpHandler> consumer=o -> {
      if (o instanceof SessionDetailsProvider) {
        final SessionDetailsProvider sessionDetails=(SessionDetailsProvider)o;
        nc.heartbeatTimeoutMs(heartbeatTimeoutMs());
        nc.sessionDetails(sessionDetails);
        nc.wireType(sessionDetails.wireType());
        final WireType wireType=nc.sessionDetails().wireType();
        if (wireType != null)         nc.wireOutPublisher().wireType(wireType);
        return new EngineWireHandler();
      }
 else       if (o instanceof TcpHandler)       return (TcpHandler)o;
      throw new UnsupportedOperationException("String_Node_Str" + o.getClass());
    }
;
    if (nc.networkStatsListener() == null) {
      nc.networkStatsListener(new NetworkStatsListener(){
        String host;
        long port;
        @Override public void onNetworkStats(        long writeBps,        long readBps,        long socketPollCountPerSecond,        @NotNull NetworkContext networkContext,        boolean connectionStatus){
          LOG.info("String_Node_Str" + writeBps / 1000 + "String_Node_Str" + readBps / 1000 + "String_Node_Str" + socketPollCountPerSecond + "String_Node_Str" + host + "String_Node_Str" + port);
        }
        @Override public void onHostPort(        String hostName,        int port){
          host=hostName;
          this.port=port;
        }
      }
);
    }
    final Function<EngineWireNetworkContext,TcpHandler> f=x -> new HeaderTcpHandler<>(handler,consumer,x);
    final WireTypeSniffingTcpHandler sniffer=new WireTypeSniffingTcpHandler<>(handler,nc,f);
    handler.tcpHandler(sniffer);
    return handler;
  }
;
}

Fixed version (ground truth):
public ThrowingFunction<NetworkContext,TcpEventHandler,IOException> tcpEventHandlerFactory(){
  return (networkContext) -> {
    final EngineWireNetworkContext nc=(EngineWireNetworkContext)networkContext;
    if (nc.isAcceptor())     nc.wireOutPublisher(new VanillaWireOutPublisher(WireType.TEXT));
    networkContext.serverThreadingStrategy(ServerThreadingStrategy.CONCURRENT);
    final TcpEventHandler handler=new TcpEventHandler(networkContext);
    final Function<Object,TcpHandler> consumer=o -> {
      if (o instanceof SessionDetailsProvider) {
        final SessionDetailsProvider sessionDetails=(SessionDetailsProvider)o;
        nc.heartbeatTimeoutMs(heartbeatTimeoutMs());
        nc.sessionDetails(sessionDetails);
        nc.wireType(sessionDetails.wireType());
        final WireType wireType=nc.sessionDetails().wireType();
        if (wireType != null)         nc.wireOutPublisher().wireType(wireType);
        return new EngineWireHandler();
      }
 else       if (o instanceof TcpHandler)       return (TcpHandler)o;
      throw new UnsupportedOperationException("String_Node_Str" + o.getClass());
    }
;
    if (nc.networkStatsListener() == null)     nc.networkStatsListener(defaultNetworkStatsListener);
    notifyHostPort(nc.socketChannel(),nc.networkStatsListener());
    final Function<EngineWireNetworkContext,TcpHandler> f=x -> new HeaderTcpHandler<>(handler,consumer,x);
    final WireTypeSniffingTcpHandler sniffer=new WireTypeSniffingTcpHandler<>(handler,nc,f);
    handler.tcpHandler(sniffer);
    return handler;
  }
;
}