Skip to content

Commit

Permalink
Issue #7277 - Use delegate in MavenServerConnector
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime committed Dec 22, 2021
1 parent 1e63b96 commit b32393a
Showing 1 changed file with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.net.SocketAddress;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;

Expand Down Expand Up @@ -58,8 +57,6 @@ public class MavenServerConnector extends ContainerLifeCycle implements Connecto
private String name;
private int port;
private long idleTimeout;
private HostPort serverAuthority;
private SocketAddress localAddress;

public MavenServerConnector()
{
Expand Down Expand Up @@ -261,38 +258,25 @@ public String getName()
@Override
public SocketAddress getLocalAddress()
{
return this.localAddress;
return checkDelegate().getLocalAddress();
}

@Override
public void setLocalAddress(SocketAddress localAddress)
{
Objects.requireNonNull(localAddress, "Local Address");

if (isStarted())
throw new IllegalStateException(getState());

this.localAddress = localAddress;
checkDelegate().setLocalAddress(localAddress);
}

@Override
public HostPort getServerAuthority()
{
return this.serverAuthority;
return checkDelegate().getServerAuthority();
}

@Override
public void setServerAuthority(HostPort authority)
{
if (isStarted())
throw new IllegalStateException(getState());

if (authority == null)
this.serverAuthority = null;
else if (!authority.hasHost())
throw new IllegalStateException("Server URI Authority must have host declared");
else
this.serverAuthority = authority;
checkDelegate().setServerAuthority(authority);
}

public int getLocalPort()
Expand Down

0 comments on commit b32393a

Please sign in to comment.