Cleanup for EndPointBase

This commit is contained in:
nathan 2018-01-25 17:03:59 +01:00
parent 799b9db1ef
commit dba62c131f
33 changed files with 106 additions and 106 deletions

View File

@ -20,7 +20,7 @@ import java.net.InetSocketAddress;
import dorkbox.network.connection.BootstrapWrapper;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.EndPointClient;
import dorkbox.network.connection.idle.IdleBridge;
import dorkbox.network.connection.idle.IdleSender;
@ -335,7 +335,7 @@ class Client<C extends Connection> extends EndPointClient implements Connection
@SuppressWarnings("rawtypes")
@Override
public
EndPointBase getEndPoint() {
EndPoint getEndPoint() {
return this;
}
@ -460,7 +460,7 @@ class Client<C extends Connection> extends EndPointClient implements Connection
* <p/>
* Make <b>sure</b> that you only call this <b>after</b> the client connects!
* <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")
public

View File

@ -17,7 +17,7 @@ package dorkbox.network;
import java.util.concurrent.Executor;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.serialization.CryptoSerializationManager;
import dorkbox.network.store.SettingsStore;
@ -80,7 +80,7 @@ class Configuration {
public static
Configuration localOnly() {
Configuration configuration = new Configuration();
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
return configuration;
}

View File

@ -2,7 +2,7 @@ package dorkbox.network;
import org.slf4j.Logger;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Shutdownable;
import dorkbox.network.dns.serverHandlers.DnsServerHandler;
import dorkbox.util.NamedThreadFactory;
@ -84,12 +84,12 @@ class DnsServer extends Shutdownable {
}
else if (OS.isLinux()) {
// JNI network stack is MUCH faster (but only on linux)
boss = new EpollEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
worker = new EpollEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
boss = new EpollEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
worker = new EpollEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
}
else {
boss = new NioEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", threadGroup));
worker = new NioEventLoopGroup(EndPointBase.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName, threadGroup));
boss = new NioEventLoopGroup(EndPoint.DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(threadName + "-boss", 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)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.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());
// 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)
.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
.localAddress(udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets!

View File

@ -45,7 +45,7 @@ interface Connection {
* @return the endpoint associated with this connection
*/
@SuppressWarnings("rawtypes")
EndPointBase getEndPoint();
EndPoint getEndPoint();
/**
* @return the connection (TCP or LOCAL) id of this connection.

View File

@ -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.
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
// 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
*/
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.endPoint = endPoint;
this.rmiBridge = rmiBridge;
@ -253,7 +253,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
*/
@Override
public
EndPointBase getEndPoint() {
EndPoint getEndPoint() {
return this.endPoint;
}

View File

@ -278,7 +278,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
* Invoked when a message object was received from a remote peer.
* <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,
* {@link EndPointBase#send().flush()} must be called manually.
* {@link EndPoint#send().flush()} must be called manually.
* <p/>
* {@link ISessionManager}
*/

View File

@ -51,7 +51,7 @@ import io.netty.util.NetUtil;
* represents the base of a client/server end point
*/
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!
// 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
*/
public
EndPointBase(Class<? extends EndPointBase> type, final Configuration config) throws SecurityException {
EndPoint(Class<? extends EndPoint> type, final Configuration config) throws SecurityException {
super(type);
// make sure that 'localhost' is ALWAYS our specific loopback IP address
@ -316,7 +316,7 @@ class EndPointBase extends Shutdownable {
* @return a new network connection
*/
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);
}
@ -488,7 +488,7 @@ class EndPointBase extends Shutdownable {
if (getClass() != obj.getClass()) {
return false;
}
EndPointBase other = (EndPointBase) obj;
EndPoint other = (EndPoint) obj;
if (privateKey == null) {
if (other.privateKey != null) {

View File

@ -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.
*/
public
class EndPointClient extends EndPointBase {
class EndPointClient extends EndPoint {
// is valid when there is a connection to the server, otherwise it is null
protected volatile Connection connection;

View File

@ -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.
*/
public
class EndPointServer extends EndPointBase {
class EndPointServer extends EndPoint {
public
EndPointServer(final Configuration config) throws SecurityException {

View File

@ -74,7 +74,7 @@ class KryoExtra<C extends ICryptoConnection> extends Kryo {
// writing data
private final ByteBuf tempBuffer = Unpooled.buffer(EndPointBase.udpMaxSize);
private final ByteBuf tempBuffer = Unpooled.buffer(EndPoint.udpMaxSize);
private LZ4Compressor compressor = factory.fastCompressor();
private int inputArrayLength = -1;

View File

@ -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 {
/**
* 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;
}

View File

@ -80,7 +80,7 @@ class PropertyStore extends SettingsStore {
@Override
public synchronized
ECPrivateKeyParameters getPrivateKey() throws dorkbox.util.exceptions.SecurityException {
checkAccess(EndPointBase.class);
checkAccess(EndPoint.class);
return servers.get(DB_Server.IP_SELF)
.getPrivateKey();
@ -92,7 +92,7 @@ class PropertyStore extends SettingsStore {
@Override
public synchronized
void savePrivateKey(final ECPrivateKeyParameters serverPrivateKey) throws SecurityException {
checkAccess(EndPointBase.class);
checkAccess(EndPoint.class);
servers.get(DB_Server.IP_SELF)
.setPrivateKey(serverPrivateKey);
@ -107,7 +107,7 @@ class PropertyStore extends SettingsStore {
@Override
public synchronized
ECPublicKeyParameters getPublicKey() throws SecurityException {
checkAccess(EndPointBase.class);
checkAccess(EndPoint.class);
return servers.get(DB_Server.IP_SELF)
.getPublicKey();
@ -119,7 +119,7 @@ class PropertyStore extends SettingsStore {
@Override
public synchronized
void savePublicKey(final ECPublicKeyParameters serverPublicKey) throws SecurityException {
checkAccess(EndPointBase.class);
checkAccess(EndPoint.class);
servers.get(DB_Server.IP_SELF)
.setPublicKey(serverPublicKey);

View File

@ -53,7 +53,7 @@ class RegistrationWrapper implements UdpServer {
private final KryoEncoder kryoEncoder;
private final KryoEncoderCrypto kryoEncoderCrypto;
private final EndPointBase endPointBaseConnection;
private final EndPoint endPointConnection;
// keeps track of connections (TCP/UDP-client)
private final ReentrantLock channelMapLock = new ReentrantLock();
@ -77,16 +77,16 @@ class RegistrationWrapper implements UdpServer {
public
RegistrationWrapper(final EndPointBase endPointBaseConnection,
RegistrationWrapper(final EndPoint endPointConnection,
final Logger logger,
final KryoEncoder kryoEncoder,
final KryoEncoderCrypto kryoEncoderCrypto) {
this.endPointBaseConnection = endPointBaseConnection;
this.endPointConnection = endPointConnection;
this.logger = logger;
this.kryoEncoder = kryoEncoder;
this.kryoEncoderCrypto = kryoEncoderCrypto;
if (endPointBaseConnection instanceof EndPointServer) {
if (endPointConnection instanceof EndPointServer) {
this.udpRemoteMap = new ObjectMap<InetSocketAddress, ConnectionImpl>(32, ConnectionManager.LOAD_FACTOR);
}
else {
@ -127,7 +127,7 @@ class RegistrationWrapper implements UdpServer {
*/
public
int getIdleTimeout() {
return this.endPointBaseConnection.getIdleTimeout();
return this.endPointConnection.getIdleTimeout();
}
/**
@ -138,7 +138,7 @@ class RegistrationWrapper implements UdpServer {
*/
public
boolean registerNextProtocol0() {
return this.endPointBaseConnection.registerNextProtocol0();
return this.endPointConnection.registerNextProtocol0();
}
/**
@ -147,7 +147,7 @@ class RegistrationWrapper implements UdpServer {
*/
public
void connectionConnected0(ConnectionImpl networkConnection) {
this.endPointBaseConnection.connectionConnected0(networkConnection);
this.endPointConnection.connectionConnected0(networkConnection);
}
/**
@ -157,22 +157,22 @@ class RegistrationWrapper implements UdpServer {
*/
public
Connection connection0(MetaChannel metaChannel) {
return this.endPointBaseConnection.connection0(metaChannel);
return this.endPointConnection.connection0(metaChannel);
}
public
SecureRandom getSecureRandom() {
return this.endPointBaseConnection.secureRandom;
return this.endPointConnection.secureRandom;
}
public
ECPublicKeyParameters getPublicKey() {
return this.endPointBaseConnection.publicKey;
return this.endPointConnection.publicKey;
}
public
CipherParameters getPrivateKey() {
return this.endPointBaseConnection.privateKey;
return this.endPointConnection.privateKey;
}
@ -188,13 +188,13 @@ class RegistrationWrapper implements UdpServer {
InetAddress address = tcpRemoteServer.getAddress();
byte[] hostAddress = address.getAddress();
ECPublicKeyParameters savedPublicKey = this.endPointBaseConnection.propertyStore.getRegisteredServerKey(hostAddress);
ECPublicKeyParameters savedPublicKey = this.endPointConnection.propertyStore.getRegisteredServerKey(hostAddress);
Logger logger2 = this.logger;
if (savedPublicKey == null) {
if (logger2.isDebugEnabled()) {
logger2.debug("Adding new remote IP address key for {}", address.getHostAddress());
}
this.endPointBaseConnection.propertyStore.addRegisteredServerKey(hostAddress, publicKey);
this.endPointConnection.propertyStore.addRegisteredServerKey(hostAddress, publicKey);
}
else {
// COMPARE!
@ -207,7 +207,7 @@ class RegistrationWrapper implements UdpServer {
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);
return true;
}
@ -225,7 +225,7 @@ class RegistrationWrapper implements UdpServer {
@SuppressWarnings("AutoBoxing")
public
void removeRegisteredServerKey(final byte[] hostAddress) throws SecurityException {
ECPublicKeyParameters savedPublicKey = this.endPointBaseConnection.propertyStore.getRegisteredServerKey(hostAddress);
ECPublicKeyParameters savedPublicKey = this.endPointConnection.propertyStore.getRegisteredServerKey(hostAddress);
if (savedPublicKey != null) {
Logger logger2 = this.logger;
if (logger2.isDebugEnabled()) {
@ -235,7 +235,7 @@ class RegistrationWrapper implements UdpServer {
hostAddress[2],
hostAddress[3]);
}
this.endPointBaseConnection.propertyStore.removeRegisteredServerKey(hostAddress);
this.endPointConnection.propertyStore.removeRegisteredServerKey(hostAddress);
}
}
@ -307,8 +307,8 @@ class RegistrationWrapper implements UdpServer {
public
void abortRegistrationIfClient() {
if (this.endPointBaseConnection instanceof EndPointClient) {
((EndPointClient) this.endPointBaseConnection).abortRegistration();
if (this.endPointConnection instanceof EndPointClient) {
((EndPointClient) this.endPointConnection).abortRegistration();
}
}

View File

@ -15,7 +15,7 @@
*/
package dorkbox.network.connection.registration;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.RegistrationWrapper;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler.Sharable;
@ -93,7 +93,7 @@ class RegistrationHandler extends ChannelInboundHandlerAdapter {
// also, once we notify, we unregister this.
if (registrationWrapper != null) {
MetaChannel metaChannel = registrationWrapper.closeChannel(channel, EndPointBase.maxShutdownWaitTimeInMilliSeconds);
MetaChannel metaChannel = registrationWrapper.closeChannel(channel, EndPoint.maxShutdownWaitTimeInMilliSeconds);
registrationWrapper.abortRegistrationIfClient();
return metaChannel;

View File

@ -15,7 +15,7 @@
*/
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.registration.MetaChannel;

View File

@ -15,7 +15,7 @@
*/
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.InetSocketAddress;

View File

@ -21,7 +21,7 @@ import java.net.InetSocketAddress;
import org.slf4j.Logger;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.RegistrationWrapper;
import dorkbox.network.connection.registration.MetaChannel;
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.
channel.config()
.setRecvByteBufAllocator(new FixedRecvByteBufAllocator(EndPointBase.udpMaxSize));
.setRecvByteBufAllocator(new FixedRecvByteBufAllocator(EndPoint.udpMaxSize));
ChannelPipeline pipeline = channel.pipeline();

View File

@ -24,7 +24,7 @@ import org.slf4j.Logger;
import dorkbox.network.Broadcast;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.KryoExtra;
import dorkbox.network.connection.RegistrationWrapper;
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.
context.channel()
.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.
}
@ -271,7 +271,7 @@ class RegistrationRemoteHandlerServerUDP extends MessageToMessageCodec<DatagramP
// also, once we notify, we unregister this.
if (registrationWrapper != null) {
return registrationWrapper.closeChannel(channel, EndPointBase.maxShutdownWaitTimeInMilliSeconds);
return registrationWrapper.closeChannel(channel, EndPoint.maxShutdownWaitTimeInMilliSeconds);
}
return null;

View File

@ -21,7 +21,7 @@ import org.bouncycastle.crypto.params.ParametersWithIV;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.ConnectionPointWriter;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.ISessionManager;
import dorkbox.network.connection.registration.MetaChannel;
import dorkbox.network.rmi.RmiObjectHandler;
@ -129,7 +129,7 @@ class ChannelLocalWrapper implements ChannelWrapper, ConnectionPointWriter {
@Override
public
void close(ConnectionImpl connection, ISessionManager sessionManager) {
long maxShutdownWaitTimeInMilliSeconds = EndPointBase.maxShutdownWaitTimeInMilliSeconds;
long maxShutdownWaitTimeInMilliSeconds = EndPoint.maxShutdownWaitTimeInMilliSeconds;
this.shouldFlush.set(false);

View File

@ -22,7 +22,7 @@ import org.bouncycastle.crypto.params.ParametersWithIV;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.ConnectionPointWriter;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.ISessionManager;
import dorkbox.network.connection.UdpServer;
import dorkbox.network.connection.registration.MetaChannel;
@ -175,7 +175,7 @@ class ChannelNetworkWrapper implements ChannelWrapper {
@Override
public
void close(final ConnectionImpl connection, final ISessionManager sessionManager) {
long maxShutdownWaitTimeInMilliSeconds = EndPointBase.maxShutdownWaitTimeInMilliSeconds;
long maxShutdownWaitTimeInMilliSeconds = EndPoint.maxShutdownWaitTimeInMilliSeconds;
this.tcp.close(maxShutdownWaitTimeInMilliSeconds);

View File

@ -21,7 +21,7 @@ import java.util.List;
import org.slf4j.LoggerFactory;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.serialization.CryptoSerializationManager;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@ -36,7 +36,7 @@ import io.netty.handler.codec.MessageToMessageEncoder;
public
class KryoEncoderUdp extends MessageToMessageEncoder<Object> {
private static final int maxSize = EndPointBase.udpMaxSize;
private static final int maxSize = EndPoint.udpMaxSize;
private final CryptoSerializationManager serializationManager;

View File

@ -48,7 +48,7 @@ import com.esotericsoftware.kryo.util.IntMap;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.RmiSerializationManager;
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
* 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
*

View File

@ -25,7 +25,7 @@ import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.util.IdentityMap;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.KryoExtra;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.CryptoSerializationManager;
@ -145,7 +145,7 @@ class RmiObjectLocalHandler extends RmiObjectHandler {
// have to convert the iFace -> Impl
EndPointBase endPoint = connection.getEndPoint();
EndPoint endPoint = connection.getEndPoint();
CryptoSerializationManager serialization = endPoint.getSerialization();
Class<?> rmiImpl = serialization.getRmiImpl(registration.interfaceClass);

View File

@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.KryoExtra;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.RmiSerializationManager;
@ -103,8 +103,8 @@ class RmiProxyHandler implements InvocationHandler {
this.objectID = objectID;
this.proxyString = "<proxy #" + objectID + ">";
EndPointBase endPointBaseConnection = this.connection.getEndPoint();
final RmiSerializationManager serializationManager = endPointBaseConnection.getSerialization();
EndPoint endPointConnection = this.connection.getEndPoint();
final RmiSerializationManager serializationManager = endPointConnection.getSerialization();
KryoExtra kryoExtra = null;
try {

View File

@ -20,7 +20,7 @@
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 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.spi.ILoggingEvent;
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.SimpleEntropy;
import dorkbox.util.exceptions.InitializationException;
@ -57,7 +57,7 @@ class BaseTest {
}
volatile boolean fail_check;
private final ArrayList<EndPointBase> endPointBaseConnections = new ArrayList<EndPointBase>();
private final ArrayList<EndPoint> endPointConnections = new ArrayList<EndPoint>();
public
BaseTest() {
@ -107,8 +107,8 @@ class BaseTest {
}
public
void addEndPoint(final EndPointBase endPointBaseConnection) {
this.endPointBaseConnections.add(endPointBaseConnection);
void addEndPoint(final EndPoint endPointConnection) {
this.endPointConnections.add(endPointConnection);
}
/**
@ -157,12 +157,12 @@ class BaseTest {
private
void stopEndPoints_outsideThread() {
synchronized (BaseTest.this.endPointBaseConnections) {
for (EndPointBase endPointBaseConnection : BaseTest.this.endPointBaseConnections) {
endPointBaseConnection.stop();
endPointBaseConnection.waitForShutdown();
synchronized (BaseTest.this.endPointConnections) {
for (EndPoint endPointConnection : BaseTest.this.endPointConnections) {
endPointConnection.stop();
endPointConnection.waitForShutdown();
}
BaseTest.this.endPointBaseConnections.clear();
BaseTest.this.endPointConnections.clear();
}
}
@ -226,8 +226,8 @@ class BaseTest {
}
while (true) {
synchronized (this.endPointBaseConnections) {
if (this.endPointBaseConnections.isEmpty()) {
synchronized (this.endPointConnections) {
if (this.endPointConnections.isEmpty()) {
break;
}
}

View File

@ -26,7 +26,7 @@ import java.util.TimerTask;
import org.junit.Test;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.Serialization;
import dorkbox.util.exceptions.InitializationException;
@ -42,7 +42,7 @@ class ConnectionTest extends BaseTest {
System.out.println("---- " + "Local");
Configuration configuration = new Configuration();
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
configuration.serialization = Serialization.DEFAULT();
register(configuration.serialization);

View File

@ -33,7 +33,7 @@ import org.slf4j.Logger;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.connection.Listeners;
import dorkbox.network.rmi.RmiBridge;
@ -64,8 +64,8 @@ class ListenerTest extends BaseTest {
// quick and dirty test to also test connection sub-classing
class TestConnectionA extends ConnectionImpl {
public
TestConnectionA(final Logger logger, final EndPointBase endPointBaseConnection, final RmiBridge rmiBridge) {
super(logger, endPointBaseConnection, rmiBridge);
TestConnectionA(final Logger logger, final EndPoint endPointConnection, final RmiBridge rmiBridge) {
super(logger, endPointConnection, rmiBridge);
}
public
@ -77,8 +77,8 @@ class ListenerTest extends BaseTest {
class TestConnectionB extends TestConnectionA {
public
TestConnectionB(final Logger logger, final EndPointBase endPointBaseConnection, final RmiBridge rmiBridge) {
super(logger, endPointBaseConnection, rmiBridge);
TestConnectionB(final Logger logger, final EndPoint endPointConnection, final RmiBridge rmiBridge) {
super(logger, endPointConnection, rmiBridge);
}
@Override
@ -109,7 +109,7 @@ class ListenerTest extends BaseTest {
Server server = new Server(configuration) {
@Override
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);
}
};

View File

@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.connection.Listeners;
import dorkbox.network.serialization.Serialization;
@ -52,8 +52,8 @@ class PingPongTest extends BaseTest {
public
void pingPong() throws InitializationException, SecurityException, IOException, InterruptedException {
// UDP data is kinda big. Make sure it fits into one packet.
int origSize = EndPointBase.udpMaxSize;
EndPointBase.udpMaxSize = 2048;
int origSize = EndPoint.udpMaxSize;
EndPoint.udpMaxSize = 2048;
this.fail = "Data not received.";
@ -192,7 +192,7 @@ class PingPongTest extends BaseTest {
fail(this.fail);
}
EndPointBase.udpMaxSize = origSize;
EndPoint.udpMaxSize = origSize;
}
private static

View File

@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.connection.Listeners;
import dorkbox.network.serialization.Serialization;
@ -47,8 +47,8 @@ class UnregisteredClassTest extends BaseTest {
@Test
public
void unregisteredClasses() throws InitializationException, SecurityException, IOException, InterruptedException {
int origSize = EndPointBase.udpMaxSize;
EndPointBase.udpMaxSize = 2048;
int origSize = EndPoint.udpMaxSize;
EndPoint.udpMaxSize = 2048;
Configuration configuration = new Configuration();
configuration.tcpPort = tcpPort;
@ -179,7 +179,7 @@ class UnregisteredClassTest extends BaseTest {
fail(this.fail);
}
EndPointBase.udpMaxSize = origSize;
EndPoint.udpMaxSize = origSize;
}
private

View File

@ -48,7 +48,7 @@ import dorkbox.network.Configuration;
import dorkbox.network.Server;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.Serialization;
import dorkbox.util.exceptions.InitializationException;
@ -208,7 +208,7 @@ class RmiGlobalTest extends BaseTest {
@Override
public
void apply(final Configuration configuration) {
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
}
});
}

View File

@ -28,7 +28,7 @@ import dorkbox.network.Client;
import dorkbox.network.Configuration;
import dorkbox.network.Server;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.Serialization;
import dorkbox.util.exceptions.InitializationException;
@ -58,7 +58,7 @@ class RmiSendObjectOverrideMethodTest extends BaseTest {
@Override
public
void apply(final Configuration configuration) {
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
}
});
}

View File

@ -47,7 +47,7 @@ import dorkbox.network.Client;
import dorkbox.network.Configuration;
import dorkbox.network.Server;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.serialization.Serialization;
import dorkbox.util.exceptions.InitializationException;
@ -77,7 +77,7 @@ class RmiSendObjectTest extends BaseTest {
@Override
public
void apply(final Configuration configuration) {
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
}
});
}

View File

@ -47,7 +47,7 @@ import dorkbox.network.Client;
import dorkbox.network.Configuration;
import dorkbox.network.Server;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.EndPointBase;
import dorkbox.network.connection.EndPoint;
import dorkbox.network.connection.Listener;
import dorkbox.network.connection.Listeners;
import dorkbox.network.serialization.Serialization;
@ -202,7 +202,7 @@ class RmiTest extends BaseTest {
@Override
public
void apply(final Configuration configuration) {
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
configuration.localChannelName = EndPoint.LOCAL_CHANNEL;
}
});