Class HttpTunnel
java.lang.Object
jodd.http.HttpTunnel
Simple HTTP tunnel base ready to be extended.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassSingle connection handler that performs the tunneling. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExecutorServiceprotected intTunnel listening port.protected booleanprotected ServerSocketprotected intNumber of incoming sockets connection that can be hold before processing each.protected StringTarget host.protected intTarget port.protected intThe number of threads that can be executed in parallel. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RunnableonSocketConnection(Socket socket) Invoked on incoming connection.voidstart()Starts HTTP tunnel.voidstop()Stops the tunnel, shutdowns the thread pool and closes server socket.
-
Field Details
-
threadPoolSize
protected int threadPoolSizeThe number of threads that can be executed in parallel. -
socketBacklog
protected int socketBacklogNumber of incoming sockets connection that can be hold before processing each. -
listenPort
protected int listenPortTunnel listening port. -
targetHost
Target host. -
targetPort
protected int targetPortTarget port. -
executorService
-
running
protected volatile boolean running -
serverSocket
-
-
Constructor Details
-
HttpTunnel
public HttpTunnel()
-
-
Method Details
-
start
Starts HTTP tunnel. Method ends when the tunnel is stopped.- Throws:
IOException
-
onSocketConnection
Invoked on incoming connection. By default returnsHttpTunnel.HttpTunnelConnectionto handle the connection. May be used to return custom handlers. -
stop
public void stop()Stops the tunnel, shutdowns the thread pool and closes server socket.
-