Cleanup for EndPointBase
This commit is contained in:
parent
799b9db1ef
commit
dba62c131f
@ -20,7 +20,7 @@ import java.net.InetSocketAddress;
|
|||||||
|
|
||||||
import dorkbox.network.connection.BootstrapWrapper;
|
import dorkbox.network.connection.BootstrapWrapper;
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.EndPointClient;
|
import dorkbox.network.connection.EndPointClient;
|
||||||
import dorkbox.network.connection.idle.IdleBridge;
|
import dorkbox.network.connection.idle.IdleBridge;
|
||||||
import dorkbox.network.connection.idle.IdleSender;
|
import dorkbox.network.connection.idle.IdleSender;
|
||||||
@ -335,7 +335,7 @@ class Client<C extends Connection> extends EndPointClient implements Connection
|
|||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
EndPointBase getEndPoint() {
|
EndPoint getEndPoint() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ class Client<C extends Connection> extends EndPointClient implements Connection
|
|||||||
* <p/>
|
* <p/>
|
||||||
* Make <b>sure</b> that you only call this <b>after</b> the client connects!
|
* Make <b>sure</b> that you only call this <b>after</b> the client connects!
|
||||||
* <p/>
|
* <p/>
|
||||||
* This is preferred to {@link EndPointBase#getConnections()}, as it properly does some error checking
|
* This is preferred to {@link EndPoint#getConnections()}, as it properly does some error checking
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public
|
public
|
||||||
|
@ -17,7 +17,7 @@ package dorkbox.network;
|
|||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.serialization.CryptoSerializationManager;
|
import dorkbox.network.serialization.CryptoSerializationManager;
|
||||||
import dorkbox.network.store.SettingsStore;
|
import dorkbox.network.store.SettingsStore;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class Configuration {
|
|||||||
public static
|
public static
|
||||||
Configuration localOnly() {
|
Configuration localOnly() {
|
||||||
Configuration configuration = new Configuration();
|
Configuration configuration = new Configuration();
|
||||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
|
||||||
|
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package dorkbox.network;
|
|||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Shutdownable;
|
import dorkbox.network.connection.Shutdownable;
|
||||||
import dorkbox.network.dns.serverHandlers.DnsServerHandler;
|
import dorkbox.network.dns.serverHandlers.DnsServerHandler;
|
||||||
import dorkbox.util.NamedThreadFactory;
|
import dorkbox.util.NamedThreadFactory;
|
||||||
@ -84,12 +84,12 @@ class DnsServer extends Shutdownable {
|
|||||||
}
|
}
|
||||||
else if (OS.isLinux()) {
|
else if (OS.isLinux()) {
|
||||||
// JNI network stack is MUCH faster (but only on linux)
|
// JNI network stack is MUCH faster (but only on linux)
|
||||||
boss = new EpollEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
|
boss = new EpollEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
|
||||||
worker = new EpollEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
|
worker = new EpollEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boss = new NioEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
|
boss = new NioEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
|
||||||
worker = new NioEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
|
worker = new NioEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ class DnsServer extends Shutdownable {
|
|||||||
.option(ChannelOption.SO_REUSEADDR, true)
|
.option(ChannelOption.SO_REUSEADDR, true)
|
||||||
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
|
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
|
||||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
||||||
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(EndPointBase.WRITE_BUFF_LOW, EndPointBase.WRITE_BUFF_HIGH))
|
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(EndPoint.WRITE_BUFF_LOW, EndPoint.WRITE_BUFF_HIGH))
|
||||||
.childHandler(new DnsServerHandler());
|
.childHandler(new DnsServerHandler());
|
||||||
|
|
||||||
// have to check options.host for null. we don't bind to 0.0.0.0, we bind to "null" to get the "any" address!
|
// have to check options.host for null. we don't bind to 0.0.0.0, we bind to "null" to get the "any" address!
|
||||||
@ -153,7 +153,7 @@ class DnsServer extends Shutdownable {
|
|||||||
|
|
||||||
udpBootstrap.group(worker)
|
udpBootstrap.group(worker)
|
||||||
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
|
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
|
||||||
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(EndPointBase.WRITE_BUFF_LOW, EndPointBase.WRITE_BUFF_HIGH))
|
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(EndPoint.WRITE_BUFF_LOW, EndPoint.WRITE_BUFF_HIGH))
|
||||||
|
|
||||||
// not binding to specific address, since it's driven by TCP, and that can be bound to a specific address
|
// not binding to specific address, since it's driven by TCP, and that can be bound to a specific address
|
||||||
.localAddress(udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets!
|
.localAddress(udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets!
|
||||||
|
@ -45,7 +45,7 @@ interface Connection {
|
|||||||
* @return the endpoint associated with this connection
|
* @return the endpoint associated with this connection
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
EndPointBase getEndPoint();
|
EndPoint getEndPoint();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the connection (TCP or LOCAL) id of this connection.
|
* @return the connection (TCP or LOCAL) id of this connection.
|
||||||
|
@ -120,7 +120,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
// while on the CLIENT, if the SERVER's ecc key has changed, the client will abort and show an error.
|
// while on the CLIENT, if the SERVER's ecc key has changed, the client will abort and show an error.
|
||||||
private boolean remoteKeyChanged;
|
private boolean remoteKeyChanged;
|
||||||
|
|
||||||
private final EndPointBase endPoint;
|
private final EndPoint endPoint;
|
||||||
|
|
||||||
// when true, the connection will be closed (either as RMI or as 'normal' listener execution) when the thread execution returns control
|
// when true, the connection will be closed (either as RMI or as 'normal' listener execution) when the thread execution returns control
|
||||||
// back to the network stack
|
// back to the network stack
|
||||||
@ -145,7 +145,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
* All of the parameters can be null, when metaChannel wants to get the base class type
|
* All of the parameters can be null, when metaChannel wants to get the base class type
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
ConnectionImpl(final Logger logger, final EndPointBase endPoint, final RmiBridge rmiBridge) {
|
ConnectionImpl(final Logger logger, final EndPoint endPoint, final RmiBridge rmiBridge) {
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.endPoint = endPoint;
|
this.endPoint = endPoint;
|
||||||
this.rmiBridge = rmiBridge;
|
this.rmiBridge = rmiBridge;
|
||||||
@ -253,7 +253,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
EndPointBase getEndPoint() {
|
EndPoint getEndPoint() {
|
||||||
return this.endPoint;
|
return this.endPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
* Invoked when a message object was received from a remote peer.
|
* Invoked when a message object was received from a remote peer.
|
||||||
* <p/>
|
* <p/>
|
||||||
* If data is sent in response to this event, the connection data is automatically flushed to the wire. If the data is sent in a separate thread,
|
* If data is sent in response to this event, the connection data is automatically flushed to the wire. If the data is sent in a separate thread,
|
||||||
* {@link EndPointBase#send().flush()} must be called manually.
|
* {@link EndPoint#send().flush()} must be called manually.
|
||||||
* <p/>
|
* <p/>
|
||||||
* {@link ISessionManager}
|
* {@link ISessionManager}
|
||||||
*/
|
*/
|
||||||
|
@ -51,7 +51,7 @@ import io.netty.util.NetUtil;
|
|||||||
* represents the base of a client/server end point
|
* represents the base of a client/server end point
|
||||||
*/
|
*/
|
||||||
public abstract
|
public abstract
|
||||||
class EndPointBase extends Shutdownable {
|
class EndPoint extends Shutdownable {
|
||||||
// If TCP and UDP both fill the pipe, THERE WILL BE FRAGMENTATION and dropped UDP packets!
|
// If TCP and UDP both fill the pipe, THERE WILL BE FRAGMENTATION and dropped UDP packets!
|
||||||
// it results in severe UDP packet loss and contention.
|
// it results in severe UDP packet loss and contention.
|
||||||
//
|
//
|
||||||
@ -126,7 +126,7 @@ class EndPointBase extends Shutdownable {
|
|||||||
* @throws SecurityException if unable to initialize/generate ECC keys
|
* @throws SecurityException if unable to initialize/generate ECC keys
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
EndPointBase(Class<? extends EndPointBase> type, final Configuration config) throws SecurityException {
|
EndPoint(Class<? extends EndPoint> type, final Configuration config) throws SecurityException {
|
||||||
super(type);
|
super(type);
|
||||||
|
|
||||||
// make sure that 'localhost' is ALWAYS our specific loopback IP address
|
// make sure that 'localhost' is ALWAYS our specific loopback IP address
|
||||||
@ -316,7 +316,7 @@ class EndPointBase extends Shutdownable {
|
|||||||
* @return a new network connection
|
* @return a new network connection
|
||||||
*/
|
*/
|
||||||
protected
|
protected
|
||||||
<E extends EndPointBase> ConnectionImpl newConnection(final Logger logger, final E endPoint, final RmiBridge rmiBridge) {
|
<E extends EndPoint> ConnectionImpl newConnection(final Logger logger, final E endPoint, final RmiBridge rmiBridge) {
|
||||||
return new ConnectionImpl(logger, endPoint, rmiBridge);
|
return new ConnectionImpl(logger, endPoint, rmiBridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ class EndPointBase extends Shutdownable {
|
|||||||
if (getClass() != obj.getClass()) {
|
if (getClass() != obj.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EndPointBase other = (EndPointBase) obj;
|
EndPoint other = (EndPoint) obj;
|
||||||
|
|
||||||
if (privateKey == null) {
|
if (privateKey == null) {
|
||||||
if (other.privateKey != null) {
|
if (other.privateKey != null) {
|
@ -33,7 +33,7 @@ import io.netty.channel.ChannelOption;
|
|||||||
* This serves the purpose of making sure that specific methods are not available to the end user.
|
* This serves the purpose of making sure that specific methods are not available to the end user.
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
class EndPointClient extends EndPointBase {
|
class EndPointClient extends EndPoint {
|
||||||
|
|
||||||
// is valid when there is a connection to the server, otherwise it is null
|
// is valid when there is a connection to the server, otherwise it is null
|
||||||
protected volatile Connection connection;
|
protected volatile Connection connection;
|
||||||
|
@ -24,7 +24,7 @@ import dorkbox.util.exceptions.SecurityException;
|
|||||||
* This serves the purpose of making sure that specific methods are not available to the end user.
|
* This serves the purpose of making sure that specific methods are not available to the end user.
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
class EndPointServer extends EndPointBase {
|
class EndPointServer extends EndPoint {
|
||||||
|
|
||||||
public
|
public
|
||||||
EndPointServer(final Configuration config) throws SecurityException {
|
EndPointServer(final Configuration config) throws SecurityException {
|
||||||
|
@ -74,7 +74,7 @@ class KryoExtra<C extends ICryptoConnection> extends Kryo {
|
|||||||
|
|
||||||
|
|
||||||
// writing data
|
// writing data
|
||||||
private final ByteBuf tempBuffer = Unpooled.buffer(EndPointBase.udpMaxSize);
|
private final ByteBuf tempBuffer = Unpooled.buffer(EndPoint.udpMaxSize);
|
||||||
private LZ4Compressor compressor = factory.fastCompressor();
|
private LZ4Compressor compressor = factory.fastCompressor();
|
||||||
|
|
||||||
private int inputArrayLength = -1;
|
private int inputArrayLength = -1;
|
||||||
|
@ -62,11 +62,11 @@ interface Listener {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the connection is idle for longer than the {@link EndPointBase#setIdleTimeout(int)} idle threshold.
|
* Called when the connection is idle for longer than the {@link EndPoint#setIdleTimeout(int)} idle threshold.
|
||||||
*/
|
*/
|
||||||
interface OnIdle<C extends Connection> extends Listener {
|
interface OnIdle<C extends Connection> extends Listener {
|
||||||
/**
|
/**
|
||||||
* Called when the connection is idle for longer than the {@link EndPointBase#setIdleTimeout(int)} idle threshold.
|
* Called when the connection is idle for longer than the {@link EndPoint#setIdleTimeout(int)} idle threshold.
|
||||||
*/
|
*/
|
||||||
void idle(C connection) throws IOException;
|
void idle(C connection) throws IOException;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class PropertyStore extends SettingsStore {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized
|
public synchronized
|
||||||
ECPrivateKeyParameters getPrivateKey() throws dorkbox.util.exceptions.SecurityException {
|
ECPrivateKeyParameters getPrivateKey() throws dorkbox.util.exceptions.SecurityException {
|
||||||
checkAccess(EndPointBase.class);
|
checkAccess(EndPoint.class);
|
||||||
|
|
||||||
return servers.get(DB_Server.IP_SELF)
|
return servers.get(DB_Server.IP_SELF)
|
||||||
.getPrivateKey();
|
.getPrivateKey();
|
||||||
@ -92,7 +92,7 @@ class PropertyStore extends SettingsStore {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized
|
public synchronized
|
||||||
void savePrivateKey(final ECPrivateKeyParameters serverPrivateKey) throws SecurityException {
|
void savePrivateKey(final ECPrivateKeyParameters serverPrivateKey) throws SecurityException {
|
||||||
checkAccess(EndPointBase.class);
|
checkAccess(EndPoint.class);
|
||||||
|
|
||||||
servers.get(DB_Server.IP_SELF)
|
servers.get(DB_Server.IP_SELF)
|
||||||
.setPrivateKey(serverPrivateKey);
|
.setPrivateKey(serverPrivateKey);
|
||||||
@ -107,7 +107,7 @@ class PropertyStore extends SettingsStore {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized
|
public synchronized
|
||||||
ECPublicKeyParameters getPublicKey() throws SecurityException {
|
ECPublicKeyParameters getPublicKey() throws SecurityException {
|
||||||
checkAccess(EndPointBase.class);
|
checkAccess(EndPoint.class);
|
||||||
|
|
||||||
return servers.get(DB_Server.IP_SELF)
|
return servers.get(DB_Server.IP_SELF)
|
||||||
.getPublicKey();
|
.getPublicKey();
|
||||||
@ -119,7 +119,7 @@ class PropertyStore extends SettingsStore {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized
|
public synchronized
|
||||||
void savePublicKey(final ECPublicKeyParameters serverPublicKey) throws SecurityException {
|
void savePublicKey(final ECPublicKeyParameters serverPublicKey) throws SecurityException {
|
||||||
checkAccess(EndPointBase.class);
|
checkAccess(EndPoint.class);
|
||||||
|
|
||||||
servers.get(DB_Server.IP_SELF)
|
servers.get(DB_Server.IP_SELF)
|
||||||
.setPublicKey(serverPublicKey);
|
.setPublicKey(serverPublicKey);
|
||||||
|
@ -53,7 +53,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
private final KryoEncoder kryoEncoder;
|
private final KryoEncoder kryoEncoder;
|
||||||
private final KryoEncoderCrypto kryoEncoderCrypto;
|
private final KryoEncoderCrypto kryoEncoderCrypto;
|
||||||
|
|
||||||
private final EndPointBase endPointBaseConnection;
|
private final EndPoint endPointConnection;
|
||||||
|
|
||||||
// keeps track of connections (TCP/UDP-client)
|
// keeps track of connections (TCP/UDP-client)
|
||||||
private final ReentrantLock channelMapLock = new ReentrantLock();
|
private final ReentrantLock channelMapLock = new ReentrantLock();
|
||||||
@ -77,16 +77,16 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
|
|
||||||
|
|
||||||
public
|
public
|
||||||
RegistrationWrapper(final EndPointBase endPointBaseConnection,
|
RegistrationWrapper(final EndPoint endPointConnection,
|
||||||
final Logger logger,
|
final Logger logger,
|
||||||
final KryoEncoder kryoEncoder,
|
final KryoEncoder kryoEncoder,
|
||||||
final KryoEncoderCrypto kryoEncoderCrypto) {
|
final KryoEncoderCrypto kryoEncoderCrypto) {
|
||||||
this.endPointBaseConnection = endPointBaseConnection;
|
this.endPointConnection = endPointConnection;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.kryoEncoder = kryoEncoder;
|
this.kryoEncoder = kryoEncoder;
|
||||||
this.kryoEncoderCrypto = kryoEncoderCrypto;
|
this.kryoEncoderCrypto = kryoEncoderCrypto;
|
||||||
|
|
||||||
if (endPointBaseConnection instanceof EndPointServer) {
|
if (endPointConnection instanceof EndPointServer) {
|
||||||
this.udpRemoteMap = new ObjectMap<InetSocketAddress, ConnectionImpl>(32, ConnectionManager.LOAD_FACTOR);
|
this.udpRemoteMap = new ObjectMap<InetSocketAddress, ConnectionImpl>(32, ConnectionManager.LOAD_FACTOR);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -127,7 +127,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
int getIdleTimeout() {
|
int getIdleTimeout() {
|
||||||
return this.endPointBaseConnection.getIdleTimeout();
|
return this.endPointConnection.getIdleTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,7 +138,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
boolean registerNextProtocol0() {
|
boolean registerNextProtocol0() {
|
||||||
return this.endPointBaseConnection.registerNextProtocol0();
|
return this.endPointConnection.registerNextProtocol0();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
void connectionConnected0(ConnectionImpl networkConnection) {
|
void connectionConnected0(ConnectionImpl networkConnection) {
|
||||||
this.endPointBaseConnection.connectionConnected0(networkConnection);
|
this.endPointConnection.connectionConnected0(networkConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,22 +157,22 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
Connection connection0(MetaChannel metaChannel) {
|
Connection connection0(MetaChannel metaChannel) {
|
||||||
return this.endPointBaseConnection.connection0(metaChannel);
|
return this.endPointConnection.connection0(metaChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
SecureRandom getSecureRandom() {
|
SecureRandom getSecureRandom() {
|
||||||
return this.endPointBaseConnection.secureRandom;
|
return this.endPointConnection.secureRandom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
ECPublicKeyParameters getPublicKey() {
|
ECPublicKeyParameters getPublicKey() {
|
||||||
return this.endPointBaseConnection.publicKey;
|
return this.endPointConnection.publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
CipherParameters getPrivateKey() {
|
CipherParameters getPrivateKey() {
|
||||||
return this.endPointBaseConnection.privateKey;
|
return this.endPointConnection.privateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -188,13 +188,13 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
InetAddress address = tcpRemoteServer.getAddress();
|
InetAddress address = tcpRemoteServer.getAddress();
|
||||||
byte[] hostAddress = address.getAddress();
|
byte[] hostAddress = address.getAddress();
|
||||||
|
|
||||||
ECPublicKeyParameters savedPublicKey = this.endPointBaseConnection.propertyStore.getRegisteredServerKey(hostAddress);
|
ECPublicKeyParameters savedPublicKey = this.endPointConnection.propertyStore.getRegisteredServerKey(hostAddress);
|
||||||
Logger logger2 = this.logger;
|
Logger logger2 = this.logger;
|
||||||
if (savedPublicKey == null) {
|
if (savedPublicKey == null) {
|
||||||
if (logger2.isDebugEnabled()) {
|
if (logger2.isDebugEnabled()) {
|
||||||
logger2.debug("Adding new remote IP address key for {}", address.getHostAddress());
|
logger2.debug("Adding new remote IP address key for {}", address.getHostAddress());
|
||||||
}
|
}
|
||||||
this.endPointBaseConnection.propertyStore.addRegisteredServerKey(hostAddress, publicKey);
|
this.endPointConnection.propertyStore.addRegisteredServerKey(hostAddress, publicKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// COMPARE!
|
// COMPARE!
|
||||||
@ -207,7 +207,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
byAddress = "Unknown Address";
|
byAddress = "Unknown Address";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.endPointBaseConnection.disableRemoteKeyValidation) {
|
if (this.endPointConnection.disableRemoteKeyValidation) {
|
||||||
logger2.warn("Invalid or non-matching public key from remote server. Their public key has changed. To fix, remove entry for: {}", byAddress);
|
logger2.warn("Invalid or non-matching public key from remote server. Their public key has changed. To fix, remove entry for: {}", byAddress);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
@SuppressWarnings("AutoBoxing")
|
@SuppressWarnings("AutoBoxing")
|
||||||
public
|
public
|
||||||
void removeRegisteredServerKey(final byte[] hostAddress) throws SecurityException {
|
void removeRegisteredServerKey(final byte[] hostAddress) throws SecurityException {
|
||||||
ECPublicKeyParameters savedPublicKey = this.endPointBaseConnection.propertyStore.getRegisteredServerKey(hostAddress);
|
ECPublicKeyParameters savedPublicKey = this.endPointConnection.propertyStore.getRegisteredServerKey(hostAddress);
|
||||||
if (savedPublicKey != null) {
|
if (savedPublicKey != null) {
|
||||||
Logger logger2 = this.logger;
|
Logger logger2 = this.logger;
|
||||||
if (logger2.isDebugEnabled()) {
|
if (logger2.isDebugEnabled()) {
|
||||||
@ -235,7 +235,7 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
hostAddress[2],
|
hostAddress[2],
|
||||||
hostAddress[3]);
|
hostAddress[3]);
|
||||||
}
|
}
|
||||||
this.endPointBaseConnection.propertyStore.removeRegisteredServerKey(hostAddress);
|
this.endPointConnection.propertyStore.removeRegisteredServerKey(hostAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,8 +307,8 @@ class RegistrationWrapper implements UdpServer {
|
|||||||
|
|
||||||
public
|
public
|
||||||
void abortRegistrationIfClient() {
|
void abortRegistrationIfClient() {
|
||||||
if (this.endPointBaseConnection instanceof EndPointClient) {
|
if (this.endPointConnection instanceof EndPointClient) {
|
||||||
((EndPointClient) this.endPointBaseConnection).abortRegistration();
|
((EndPointClient) this.endPointConnection).abortRegistration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package dorkbox.network.connection.registration;
|
package dorkbox.network.connection.registration;
|
||||||
|
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.RegistrationWrapper;
|
import dorkbox.network.connection.RegistrationWrapper;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
@ -93,7 +93,7 @@ class RegistrationHandler extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
// also, once we notify, we unregister this.
|
// also, once we notify, we unregister this.
|
||||||
if (registrationWrapper != null) {
|
if (registrationWrapper != null) {
|
||||||
MetaChannel metaChannel = registrationWrapper.closeChannel(channel, EndPointBase.maxShutdownWaitTimeInMilliSeconds);
|
MetaChannel metaChannel = registrationWrapper.closeChannel(channel, EndPoint.maxShutdownWaitTimeInMilliSeconds);
|
||||||
registrationWrapper.abortRegistrationIfClient();
|
registrationWrapper.abortRegistrationIfClient();
|
||||||
|
|
||||||
return metaChannel;
|
return metaChannel;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package dorkbox.network.connection.registration.local;
|
package dorkbox.network.connection.registration.local;
|
||||||
|
|
||||||
import static dorkbox.network.connection.EndPointBase.maxShutdownWaitTimeInMilliSeconds;
|
import static dorkbox.network.connection.EndPoint.maxShutdownWaitTimeInMilliSeconds;
|
||||||
|
|
||||||
import dorkbox.network.connection.RegistrationWrapper;
|
import dorkbox.network.connection.RegistrationWrapper;
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package dorkbox.network.connection.registration.remote;
|
package dorkbox.network.connection.registration.remote;
|
||||||
|
|
||||||
import static dorkbox.network.connection.EndPointBase.maxShutdownWaitTimeInMilliSeconds;
|
import static dorkbox.network.connection.EndPoint.maxShutdownWaitTimeInMilliSeconds;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
@ -21,7 +21,7 @@ import java.net.InetSocketAddress;
|
|||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.RegistrationWrapper;
|
import dorkbox.network.connection.RegistrationWrapper;
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
import dorkbox.network.connection.registration.Registration;
|
import dorkbox.network.connection.registration.Registration;
|
||||||
@ -59,7 +59,7 @@ class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandlerClient
|
|||||||
|
|
||||||
// Netty4 has default of 2048 bytes as upper limit for datagram packets.
|
// Netty4 has default of 2048 bytes as upper limit for datagram packets.
|
||||||
channel.config()
|
channel.config()
|
||||||
.setRecvByteBufAllocator(new FixedRecvByteBufAllocator(EndPointBase.udpMaxSize));
|
.setRecvByteBufAllocator(new FixedRecvByteBufAllocator(EndPoint.udpMaxSize));
|
||||||
|
|
||||||
ChannelPipeline pipeline = channel.pipeline();
|
ChannelPipeline pipeline = channel.pipeline();
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import org.slf4j.Logger;
|
|||||||
|
|
||||||
import dorkbox.network.Broadcast;
|
import dorkbox.network.Broadcast;
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.KryoExtra;
|
import dorkbox.network.connection.KryoExtra;
|
||||||
import dorkbox.network.connection.RegistrationWrapper;
|
import dorkbox.network.connection.RegistrationWrapper;
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
@ -76,7 +76,7 @@ class RegistrationRemoteHandlerServerUDP extends MessageToMessageCodec<DatagramP
|
|||||||
// Netty4 has default of 2048 bytes as upper limit for datagram packets.
|
// Netty4 has default of 2048 bytes as upper limit for datagram packets.
|
||||||
context.channel()
|
context.channel()
|
||||||
.config()
|
.config()
|
||||||
.setRecvByteBufAllocator(new FixedRecvByteBufAllocator(EndPointBase.udpMaxSize));
|
.setRecvByteBufAllocator(new FixedRecvByteBufAllocator(EndPoint.udpMaxSize));
|
||||||
|
|
||||||
// do NOT want to add UDP channels, since they are tracked differently for the server.
|
// do NOT want to add UDP channels, since they are tracked differently for the server.
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ class RegistrationRemoteHandlerServerUDP extends MessageToMessageCodec<DatagramP
|
|||||||
|
|
||||||
// also, once we notify, we unregister this.
|
// also, once we notify, we unregister this.
|
||||||
if (registrationWrapper != null) {
|
if (registrationWrapper != null) {
|
||||||
return registrationWrapper.closeChannel(channel, EndPointBase.maxShutdownWaitTimeInMilliSeconds);
|
return registrationWrapper.closeChannel(channel, EndPoint.maxShutdownWaitTimeInMilliSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -21,7 +21,7 @@ import org.bouncycastle.crypto.params.ParametersWithIV;
|
|||||||
|
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.ConnectionPointWriter;
|
import dorkbox.network.connection.ConnectionPointWriter;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.ISessionManager;
|
import dorkbox.network.connection.ISessionManager;
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
import dorkbox.network.rmi.RmiObjectHandler;
|
import dorkbox.network.rmi.RmiObjectHandler;
|
||||||
@ -129,7 +129,7 @@ class ChannelLocalWrapper implements ChannelWrapper, ConnectionPointWriter {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void close(ConnectionImpl connection, ISessionManager sessionManager) {
|
void close(ConnectionImpl connection, ISessionManager sessionManager) {
|
||||||
long maxShutdownWaitTimeInMilliSeconds = EndPointBase.maxShutdownWaitTimeInMilliSeconds;
|
long maxShutdownWaitTimeInMilliSeconds = EndPoint.maxShutdownWaitTimeInMilliSeconds;
|
||||||
|
|
||||||
this.shouldFlush.set(false);
|
this.shouldFlush.set(false);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import org.bouncycastle.crypto.params.ParametersWithIV;
|
|||||||
|
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.ConnectionPointWriter;
|
import dorkbox.network.connection.ConnectionPointWriter;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.ISessionManager;
|
import dorkbox.network.connection.ISessionManager;
|
||||||
import dorkbox.network.connection.UdpServer;
|
import dorkbox.network.connection.UdpServer;
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
@ -175,7 +175,7 @@ class ChannelNetworkWrapper implements ChannelWrapper {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void close(final ConnectionImpl connection, final ISessionManager sessionManager) {
|
void close(final ConnectionImpl connection, final ISessionManager sessionManager) {
|
||||||
long maxShutdownWaitTimeInMilliSeconds = EndPointBase.maxShutdownWaitTimeInMilliSeconds;
|
long maxShutdownWaitTimeInMilliSeconds = EndPoint.maxShutdownWaitTimeInMilliSeconds;
|
||||||
|
|
||||||
this.tcp.close(maxShutdownWaitTimeInMilliSeconds);
|
this.tcp.close(maxShutdownWaitTimeInMilliSeconds);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.serialization.CryptoSerializationManager;
|
import dorkbox.network.serialization.CryptoSerializationManager;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
@ -36,7 +36,7 @@ import io.netty.handler.codec.MessageToMessageEncoder;
|
|||||||
public
|
public
|
||||||
class KryoEncoderUdp extends MessageToMessageEncoder<Object> {
|
class KryoEncoderUdp extends MessageToMessageEncoder<Object> {
|
||||||
|
|
||||||
private static final int maxSize = EndPointBase.udpMaxSize;
|
private static final int maxSize = EndPoint.udpMaxSize;
|
||||||
private final CryptoSerializationManager serializationManager;
|
private final CryptoSerializationManager serializationManager;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ import com.esotericsoftware.kryo.util.IntMap;
|
|||||||
|
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.RmiSerializationManager;
|
import dorkbox.network.serialization.RmiSerializationManager;
|
||||||
import dorkbox.util.collections.ObjectIntMap;
|
import dorkbox.util.collections.ObjectIntMap;
|
||||||
@ -193,7 +193,7 @@ class RmiBridge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes the method on the object and, if necessary, sends the result back to the connection that made the invocation request. This
|
* Invokes the method on the object and, if necessary, sends the result back to the connection that made the invocation request. This
|
||||||
* method is invoked on the update thread of the {@link EndPointBase} for this RmiBridge and unless an executor has been set.
|
* method is invoked on the update thread of the {@link EndPoint} for this RmiBridge and unless an executor has been set.
|
||||||
*
|
*
|
||||||
* This is the response to the invoke method in the RmiProxyHandler
|
* This is the response to the invoke method in the RmiProxyHandler
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,7 @@ import com.esotericsoftware.kryo.Serializer;
|
|||||||
import com.esotericsoftware.kryo.util.IdentityMap;
|
import com.esotericsoftware.kryo.util.IdentityMap;
|
||||||
|
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.KryoExtra;
|
import dorkbox.network.connection.KryoExtra;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.CryptoSerializationManager;
|
import dorkbox.network.serialization.CryptoSerializationManager;
|
||||||
@ -145,7 +145,7 @@ class RmiObjectLocalHandler extends RmiObjectHandler {
|
|||||||
|
|
||||||
|
|
||||||
// have to convert the iFace -> Impl
|
// have to convert the iFace -> Impl
|
||||||
EndPointBase endPoint = connection.getEndPoint();
|
EndPoint endPoint = connection.getEndPoint();
|
||||||
CryptoSerializationManager serialization = endPoint.getSerialization();
|
CryptoSerializationManager serialization = endPoint.getSerialization();
|
||||||
|
|
||||||
Class<?> rmiImpl = serialization.getRmiImpl(registration.interfaceClass);
|
Class<?> rmiImpl = serialization.getRmiImpl(registration.interfaceClass);
|
||||||
|
@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.KryoExtra;
|
import dorkbox.network.connection.KryoExtra;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.RmiSerializationManager;
|
import dorkbox.network.serialization.RmiSerializationManager;
|
||||||
@ -103,8 +103,8 @@ class RmiProxyHandler implements InvocationHandler {
|
|||||||
this.objectID = objectID;
|
this.objectID = objectID;
|
||||||
this.proxyString = "<proxy #" + objectID + ">";
|
this.proxyString = "<proxy #" + objectID + ">";
|
||||||
|
|
||||||
EndPointBase endPointBaseConnection = this.connection.getEndPoint();
|
EndPoint endPointConnection = this.connection.getEndPoint();
|
||||||
final RmiSerializationManager serializationManager = endPointBaseConnection.getSerialization();
|
final RmiSerializationManager serializationManager = endPointConnection.getSerialization();
|
||||||
|
|
||||||
KryoExtra kryoExtra = null;
|
KryoExtra kryoExtra = null;
|
||||||
try {
|
try {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
package dorkbox.network;
|
package dorkbox.network;
|
||||||
|
|
||||||
|
|
||||||
import static dorkbox.network.connection.EndPointBase.THREADGROUP_NAME;
|
import static dorkbox.network.connection.EndPoint.THREADGROUP_NAME;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -34,7 +34,7 @@ import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
|
|||||||
import ch.qos.logback.classic.joran.JoranConfigurator;
|
import ch.qos.logback.classic.joran.JoranConfigurator;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.ConsoleAppender;
|
import ch.qos.logback.core.ConsoleAppender;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.util.entropy.Entropy;
|
import dorkbox.util.entropy.Entropy;
|
||||||
import dorkbox.util.entropy.SimpleEntropy;
|
import dorkbox.util.entropy.SimpleEntropy;
|
||||||
import dorkbox.util.exceptions.InitializationException;
|
import dorkbox.util.exceptions.InitializationException;
|
||||||
@ -57,7 +57,7 @@ class BaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
volatile boolean fail_check;
|
volatile boolean fail_check;
|
||||||
private final ArrayList<EndPointBase> endPointBaseConnections = new ArrayList<EndPointBase>();
|
private final ArrayList<EndPoint> endPointConnections = new ArrayList<EndPoint>();
|
||||||
|
|
||||||
public
|
public
|
||||||
BaseTest() {
|
BaseTest() {
|
||||||
@ -107,8 +107,8 @@ class BaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
void addEndPoint(final EndPointBase endPointBaseConnection) {
|
void addEndPoint(final EndPoint endPointConnection) {
|
||||||
this.endPointBaseConnections.add(endPointBaseConnection);
|
this.endPointConnections.add(endPointConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,12 +157,12 @@ class BaseTest {
|
|||||||
|
|
||||||
private
|
private
|
||||||
void stopEndPoints_outsideThread() {
|
void stopEndPoints_outsideThread() {
|
||||||
synchronized (BaseTest.this.endPointBaseConnections) {
|
synchronized (BaseTest.this.endPointConnections) {
|
||||||
for (EndPointBase endPointBaseConnection : BaseTest.this.endPointBaseConnections) {
|
for (EndPoint endPointConnection : BaseTest.this.endPointConnections) {
|
||||||
endPointBaseConnection.stop();
|
endPointConnection.stop();
|
||||||
endPointBaseConnection.waitForShutdown();
|
endPointConnection.waitForShutdown();
|
||||||
}
|
}
|
||||||
BaseTest.this.endPointBaseConnections.clear();
|
BaseTest.this.endPointConnections.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +226,8 @@ class BaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
synchronized (this.endPointBaseConnections) {
|
synchronized (this.endPointConnections) {
|
||||||
if (this.endPointBaseConnections.isEmpty()) {
|
if (this.endPointConnections.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import java.util.TimerTask;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
import dorkbox.util.exceptions.InitializationException;
|
import dorkbox.util.exceptions.InitializationException;
|
||||||
@ -42,7 +42,7 @@ class ConnectionTest extends BaseTest {
|
|||||||
System.out.println("---- " + "Local");
|
System.out.println("---- " + "Local");
|
||||||
|
|
||||||
Configuration configuration = new Configuration();
|
Configuration configuration = new Configuration();
|
||||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
|
||||||
configuration.serialization = Serialization.DEFAULT();
|
configuration.serialization = Serialization.DEFAULT();
|
||||||
register(configuration.serialization);
|
register(configuration.serialization);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import org.slf4j.Logger;
|
|||||||
|
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.connection.Listeners;
|
import dorkbox.network.connection.Listeners;
|
||||||
import dorkbox.network.rmi.RmiBridge;
|
import dorkbox.network.rmi.RmiBridge;
|
||||||
@ -64,8 +64,8 @@ class ListenerTest extends BaseTest {
|
|||||||
// quick and dirty test to also test connection sub-classing
|
// quick and dirty test to also test connection sub-classing
|
||||||
class TestConnectionA extends ConnectionImpl {
|
class TestConnectionA extends ConnectionImpl {
|
||||||
public
|
public
|
||||||
TestConnectionA(final Logger logger, final EndPointBase endPointBaseConnection, final RmiBridge rmiBridge) {
|
TestConnectionA(final Logger logger, final EndPoint endPointConnection, final RmiBridge rmiBridge) {
|
||||||
super(logger, endPointBaseConnection, rmiBridge);
|
super(logger, endPointConnection, rmiBridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
@ -77,8 +77,8 @@ class ListenerTest extends BaseTest {
|
|||||||
|
|
||||||
class TestConnectionB extends TestConnectionA {
|
class TestConnectionB extends TestConnectionA {
|
||||||
public
|
public
|
||||||
TestConnectionB(final Logger logger, final EndPointBase endPointBaseConnection, final RmiBridge rmiBridge) {
|
TestConnectionB(final Logger logger, final EndPoint endPointConnection, final RmiBridge rmiBridge) {
|
||||||
super(logger, endPointBaseConnection, rmiBridge);
|
super(logger, endPointConnection, rmiBridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,7 +109,7 @@ class ListenerTest extends BaseTest {
|
|||||||
Server server = new Server(configuration) {
|
Server server = new Server(configuration) {
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
TestConnectionA newConnection(final Logger logger, final EndPointBase endPoint, final RmiBridge rmiBridge) {
|
TestConnectionA newConnection(final Logger logger, final EndPoint endPoint, final RmiBridge rmiBridge) {
|
||||||
return new TestConnectionA(logger, endPoint, rmiBridge);
|
return new TestConnectionA(logger, endPoint, rmiBridge);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.connection.Listeners;
|
import dorkbox.network.connection.Listeners;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
@ -52,8 +52,8 @@ class PingPongTest extends BaseTest {
|
|||||||
public
|
public
|
||||||
void pingPong() throws InitializationException, SecurityException, IOException, InterruptedException {
|
void pingPong() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||||
// UDP data is kinda big. Make sure it fits into one packet.
|
// UDP data is kinda big. Make sure it fits into one packet.
|
||||||
int origSize = EndPointBase.udpMaxSize;
|
int origSize = EndPoint.udpMaxSize;
|
||||||
EndPointBase.udpMaxSize = 2048;
|
EndPoint.udpMaxSize = 2048;
|
||||||
|
|
||||||
this.fail = "Data not received.";
|
this.fail = "Data not received.";
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ class PingPongTest extends BaseTest {
|
|||||||
fail(this.fail);
|
fail(this.fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndPointBase.udpMaxSize = origSize;
|
EndPoint.udpMaxSize = origSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static
|
private static
|
||||||
|
@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.connection.Listeners;
|
import dorkbox.network.connection.Listeners;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
@ -47,8 +47,8 @@ class UnregisteredClassTest extends BaseTest {
|
|||||||
@Test
|
@Test
|
||||||
public
|
public
|
||||||
void unregisteredClasses() throws InitializationException, SecurityException, IOException, InterruptedException {
|
void unregisteredClasses() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||||
int origSize = EndPointBase.udpMaxSize;
|
int origSize = EndPoint.udpMaxSize;
|
||||||
EndPointBase.udpMaxSize = 2048;
|
EndPoint.udpMaxSize = 2048;
|
||||||
|
|
||||||
Configuration configuration = new Configuration();
|
Configuration configuration = new Configuration();
|
||||||
configuration.tcpPort = tcpPort;
|
configuration.tcpPort = tcpPort;
|
||||||
@ -179,7 +179,7 @@ class UnregisteredClassTest extends BaseTest {
|
|||||||
fail(this.fail);
|
fail(this.fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndPointBase.udpMaxSize = origSize;
|
EndPoint.udpMaxSize = origSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -48,7 +48,7 @@ import dorkbox.network.Configuration;
|
|||||||
import dorkbox.network.Server;
|
import dorkbox.network.Server;
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.ConnectionImpl;
|
import dorkbox.network.connection.ConnectionImpl;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
import dorkbox.util.exceptions.InitializationException;
|
import dorkbox.util.exceptions.InitializationException;
|
||||||
@ -208,7 +208,7 @@ class RmiGlobalTest extends BaseTest {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void apply(final Configuration configuration) {
|
void apply(final Configuration configuration) {
|
||||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import dorkbox.network.Client;
|
|||||||
import dorkbox.network.Configuration;
|
import dorkbox.network.Configuration;
|
||||||
import dorkbox.network.Server;
|
import dorkbox.network.Server;
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
import dorkbox.util.exceptions.InitializationException;
|
import dorkbox.util.exceptions.InitializationException;
|
||||||
@ -58,7 +58,7 @@ class RmiSendObjectOverrideMethodTest extends BaseTest {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void apply(final Configuration configuration) {
|
void apply(final Configuration configuration) {
|
||||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ import dorkbox.network.Client;
|
|||||||
import dorkbox.network.Configuration;
|
import dorkbox.network.Configuration;
|
||||||
import dorkbox.network.Server;
|
import dorkbox.network.Server;
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
import dorkbox.util.exceptions.InitializationException;
|
import dorkbox.util.exceptions.InitializationException;
|
||||||
@ -77,7 +77,7 @@ class RmiSendObjectTest extends BaseTest {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void apply(final Configuration configuration) {
|
void apply(final Configuration configuration) {
|
||||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ import dorkbox.network.Client;
|
|||||||
import dorkbox.network.Configuration;
|
import dorkbox.network.Configuration;
|
||||||
import dorkbox.network.Server;
|
import dorkbox.network.Server;
|
||||||
import dorkbox.network.connection.Connection;
|
import dorkbox.network.connection.Connection;
|
||||||
import dorkbox.network.connection.EndPointBase;
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.network.connection.Listener;
|
import dorkbox.network.connection.Listener;
|
||||||
import dorkbox.network.connection.Listeners;
|
import dorkbox.network.connection.Listeners;
|
||||||
import dorkbox.network.serialization.Serialization;
|
import dorkbox.network.serialization.Serialization;
|
||||||
@ -202,7 +202,7 @@ class RmiTest extends BaseTest {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void apply(final Configuration configuration) {
|
void apply(final Configuration configuration) {
|
||||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user