public class DefaultHttpProxyServer extends Object implements HttpProxyServer
Primary implementation of an HttpProxyServer.
DefaultHttpProxyServer is bootstrapped by calling
bootstrap() or bootstrapFromFile(String), and then calling
DefaultHttpProxyServerBootstrap#start(). For example:
DefaultHttpProxyServer server =
DefaultHttpProxyServer
.bootstrap()
.withPort(8090)
.start();
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Stops the server and all related clones immediately, without waiting for traffic to stop.
|
static HttpProxyServerBootstrap |
bootstrap()
Bootstrap a new
DefaultHttpProxyServer starting from scratch. |
static HttpProxyServerBootstrap |
bootstrapFromFile(String path)
Bootstrap a new
DefaultHttpProxyServer using defaults from the
given file. |
HttpProxyServerBootstrap |
clone()
Clone the existing server, with a port 1 higher and everything else the
same.
|
protected void |
closeAllChannels(boolean graceful)
Closes all channels opened by this proxy server.
|
protected void |
doStop(boolean graceful)
Performs cleanup necessary to stop the server.
|
protected Collection<ActivityTracker> |
getActivityTrackers() |
protected ChainedProxyManager |
getChainProxyManager() |
int |
getConnectTimeout()
Returns the maximum time to wait, in milliseconds, to connect to a server.
|
HttpFiltersSource |
getFiltersSource() |
int |
getIdleConnectionTimeout() |
InetSocketAddress |
getListenAddress()
Return the address on which this proxy is listening.
|
InetSocketAddress |
getLocalAddress() |
int |
getMaxChunkSize() |
int |
getMaxHeaderSize() |
int |
getMaxInitialLineLength() |
protected MitmManager |
getMitmManager() |
String |
getProxyAlias() |
protected ProxyAuthenticator |
getProxyAuthenticator() |
protected io.netty.channel.EventLoopGroup |
getProxyToServerWorkerFor(TransportProtocol transportProtocol) |
long |
getReadThrottle() |
HostResolver |
getServerResolver() |
protected SslEngineSource |
getSslEngineSource() |
long |
getWriteThrottle() |
protected void |
registerChannel(io.netty.channel.Channel channel)
Register a new
Channel with this server, for later closing. |
void |
setConnectTimeout(int connectTimeoutMs)
Sets the maximum time to wait, in milliseconds, to connect to a server.
|
void |
setIdleConnectionTimeout(int idleConnectionTimeout) |
void |
setThrottle(long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond)
Set the read/write throttle bandwidths (in bytes/second) for this proxy.
|
void |
stop()
Stops the server and all related clones.
|
public static HttpProxyServerBootstrap bootstrap()
DefaultHttpProxyServer starting from scratch.public static HttpProxyServerBootstrap bootstrapFromFile(String path)
DefaultHttpProxyServer using defaults from the
given file.path - public int getIdleConnectionTimeout()
getIdleConnectionTimeout in interface HttpProxyServerpublic void setIdleConnectionTimeout(int idleConnectionTimeout)
setIdleConnectionTimeout in interface HttpProxyServerpublic int getConnectTimeout()
HttpProxyServergetConnectTimeout in interface HttpProxyServerpublic void setConnectTimeout(int connectTimeoutMs)
HttpProxyServersetConnectTimeout in interface HttpProxyServerpublic HostResolver getServerResolver()
public InetSocketAddress getLocalAddress()
public InetSocketAddress getListenAddress()
HttpProxyServergetListenAddress in interface HttpProxyServerpublic void setThrottle(long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond)
HttpProxyServerSet the read/write throttle bandwidths (in bytes/second) for this proxy.
setThrottle in interface HttpProxyServerpublic long getReadThrottle()
public long getWriteThrottle()
public int getMaxInitialLineLength()
public int getMaxHeaderSize()
public int getMaxChunkSize()
public HttpProxyServerBootstrap clone()
HttpProxyServerClone the existing server, with a port 1 higher and everything else the same. If the proxy was started with port 0 (JVM-assigned port), the cloned proxy will also use a JVM-assigned port.
The new server will share event loops with the original server. The event loops will use whatever name was given to the first server in the clone group. The server group will not terminate until the original server and all clones terminate.
clone in interface HttpProxyServerclone in class Objectpublic void stop()
HttpProxyServerstop in interface HttpProxyServerpublic void abort()
HttpProxyServerabort in interface HttpProxyServerprotected void doStop(boolean graceful)
graceful - when true, waits for requests to terminate before stopping the serverprotected void registerChannel(io.netty.channel.Channel channel)
Channel with this server, for later closing.channel - protected void closeAllChannels(boolean graceful)
graceful - when false, attempts to shutdown all channels immediately and ignores any channel-closing exceptionsprotected ChainedProxyManager getChainProxyManager()
protected MitmManager getMitmManager()
protected SslEngineSource getSslEngineSource()
protected ProxyAuthenticator getProxyAuthenticator()
public HttpFiltersSource getFiltersSource()
protected Collection<ActivityTracker> getActivityTrackers()
protected io.netty.channel.EventLoopGroup getProxyToServerWorkerFor(TransportProtocol transportProtocol)
public String getProxyAlias()
Copyright © 2009–2016 LittleShoot. All rights reserved.