package com.forerunnergames.tools.net.server;

import com.forerunnergames.tools.common.Arguments;
import com.forerunnergames.tools.net.annotations.RequiredForNetworkSerialization;

public final class DefaultServerConfiguration implements ServerConfiguration
{
  private final String serverAddress;
  private final int serverTcpPort;

  public DefaultServerConfiguration (final String serverAddress, final int serverTcpPort)
  {
    Arguments.checkIsNotNull (serverAddress, "serverAddress");
    Arguments.checkIsNotNegative (serverTcpPort, "serverTcpPort");

    this.serverAddress = serverAddress;
    this.serverTcpPort = serverTcpPort;
  }

  @Override
  public String getServerAddress ()
  {
    return serverAddress;
  }

  @Override
  public int getServerTcpPort ()
  {
    return serverTcpPort;
  }

  @Override
  public String toString ()
  {
    return String.format ("%1$s: Server address: %2$s | Server port: %3$s (TCP)", getClass ().getSimpleName (),
                          serverAddress, serverTcpPort);
  }

  @RequiredForNetworkSerialization
  private DefaultServerConfiguration ()
  {
    serverAddress = null;
    serverTcpPort = 0;
  }
}

@@ -91,16 +91,71 @@
 uments;%0A
+import com.forerunnergames.tools.net.NetworkConstants;%0A
 import c
@@ -605,16 +605,116 @@
 pPort%22);
+%0A    Arguments.checkUpperInclusiveBound (serverTcpPort, NetworkConstants.MAX_PORT, %22serverTcpPort%22);
 %0A%0A    th

Add port arg check to DefaultServerConfiguration.