Class TunnelClient
- java.lang.Object
- org.springframework.boot.devtools.tunnel.client.TunnelClient
- All Implemented Interfaces:
org.springframework.beans.factory.SmartInitializingSingleton
public class TunnelClient extends Object implements org.springframework.beans.factory.SmartInitializingSingleton
The client side component of a socket tunnel. Starts aServerSocket
of the specified port for local clients to connect to.- Since:
- 1.3.0
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TunnelClient.ServerThread
The main server thread.
Constructor Summary
Constructors Constructor Description TunnelClient(int listenPort, TunnelConnection tunnelConnection)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(TunnelClientListener listener)
void
afterSingletonsInstantiated()
protected TunnelClient.ServerThread
getServerThread()
void
removeListener(TunnelClientListener listener)
int
start()
Start the client and accept incoming connections.void
stop()
Stop the client, disconnecting any servers.
Constructor Detail
TunnelClient
public TunnelClient(int listenPort, TunnelConnection tunnelConnection)
Method Detail
afterSingletonsInstantiated
public void afterSingletonsInstantiated()
- Specified by:
afterSingletonsInstantiated
in interfaceorg.springframework.beans.factory.SmartInitializingSingleton
start
public int start() throws IOException
Start the client and accept incoming connections.- Returns:
- the port on which the client is listening
- Throws:
IOException
- in case of I/O errors
stop
public void stop() throws IOException
Stop the client, disconnecting any servers.- Throws:
IOException
- in case of I/O errors
getServerThread
protected final TunnelClient.ServerThread getServerThread()
addListener
public void addListener(TunnelClientListener listener)
removeListener
public void removeListener(TunnelClientListener listener)