use of org.littleshoot.proxy.impl.ThreadPoolConfiguration in project nifi by apache.
the class TestHttpClient method startProxyServerWithAuth.
private static void startProxyServerWithAuth() throws IOException {
int proxyServerPort;
try (final ServerSocket serverSocket = new ServerSocket(0)) {
proxyServerPort = serverSocket.getLocalPort();
}
proxyServerWithAuth = DefaultHttpProxyServer.bootstrap().withPort(proxyServerPort).withAllowLocalOnly(true).withProxyAuthenticator(new ProxyAuthenticator() {
@Override
public boolean authenticate(String userName, String password) {
return PROXY_USER.equals(userName) && PROXY_PASSWORD.equals(password);
}
@Override
public String getRealm() {
return "NiFi Unit Test";
}
}).withThreadPoolConfiguration(new ThreadPoolConfiguration().withAcceptorThreads(2).withClientToProxyWorkerThreads(4).withProxyToServerWorkerThreads(4)).start();
}
use of org.littleshoot.proxy.impl.ThreadPoolConfiguration in project nifi by apache.
the class TestHttpClient method startProxyServer.
private static void startProxyServer() throws IOException {
int proxyServerPort;
try (final ServerSocket serverSocket = new ServerSocket(0)) {
proxyServerPort = serverSocket.getLocalPort();
}
proxyServer = DefaultHttpProxyServer.bootstrap().withPort(proxyServerPort).withAllowLocalOnly(true).withThreadPoolConfiguration(new ThreadPoolConfiguration().withAcceptorThreads(2).withClientToProxyWorkerThreads(4).withProxyToServerWorkerThreads(4)).start();
}
Aggregations