protected final HttpServer prepareHttpServer ( LoopResources loopResources , int port , GatewayMetrics metrics ) { return HttpServer . create ( ) . tcpConfiguration ( tcpServer -> { if ( loopResources != null ) { tcpServer = tcpServer . runOn ( loopResources ) ; } if ( metrics != null ) { tcpServer = tcpServer . doOnConnection ( connection -> { metrics . incConnection ( ) ; connection . onDispose ( metrics :: decConnection ) ; } ) ; } return tcpServer . addressSupplier ( ( ) -> new InetSocketAddress ( port ) ) ; } ) ; }
Builds generic http server with given parameters .