Issue #12023 - Remove deprecated classes/methods.

Removed deprecated methods from EndPoint.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2024-08-07 12:17:39 +02:00
parent 1af998065d
commit b9bcb58a6d
6 changed files with 2 additions and 94 deletions

View File

@ -14,7 +14,6 @@
package org.eclipse.jetty.http2;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
@ -54,30 +53,12 @@ public abstract class HTTP2StreamEndPoint implements EndPoint
this.stream = stream;
}
@Override
public InetSocketAddress getLocalAddress()
{
SocketAddress local = getLocalSocketAddress();
if (local instanceof InetSocketAddress)
return (InetSocketAddress)local;
return null;
}
@Override
public SocketAddress getLocalSocketAddress()
{
return stream.getSession().getLocalSocketAddress();
}
@Override
public InetSocketAddress getRemoteAddress()
{
SocketAddress remote = getRemoteSocketAddress();
if (remote instanceof InetSocketAddress)
return (InetSocketAddress)remote;
return null;
}
@Override
public SocketAddress getRemoteSocketAddress()
{

View File

@ -14,7 +14,6 @@
package org.eclipse.jetty.io;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.WritePendingException;
@ -59,27 +58,9 @@ public abstract class AbstractEndPoint extends IdleTimeout implements EndPoint
super(scheduler);
}
@Override
public InetSocketAddress getLocalAddress()
{
SocketAddress local = getLocalSocketAddress();
if (local instanceof InetSocketAddress)
return (InetSocketAddress)local;
return null;
}
@Override
public abstract SocketAddress getLocalSocketAddress();
@Override
public InetSocketAddress getRemoteAddress()
{
SocketAddress remote = getRemoteSocketAddress();
if (remote instanceof InetSocketAddress)
return (InetSocketAddress)remote;
return null;
}
@Override
public abstract SocketAddress getRemoteSocketAddress();

View File

@ -84,38 +84,22 @@ public interface EndPoint extends Closeable, Content.Sink
EndPoint unwrap();
}
/**
* @return The local InetSocketAddress to which this {@code EndPoint} is bound, or {@code null}
* if this {@code EndPoint} is not bound to a Socket address.
* @deprecated use {@link #getLocalSocketAddress()} instead
*/
@Deprecated
InetSocketAddress getLocalAddress();
/**
* @return the local SocketAddress to which this {@code EndPoint} is bound or {@code null}
* if this {@code EndPoint} is not bound to a Socket address.
*/
default SocketAddress getLocalSocketAddress()
{
return getLocalAddress();
return null;
}
/**
* @return The remote InetSocketAddress to which this {@code EndPoint} is connected, or {@code null}
* if this {@code EndPoint} is not connected to a Socket address.
* @deprecated use {@link #getRemoteSocketAddress()} instead.
*/
@Deprecated
InetSocketAddress getRemoteAddress();
/**
* @return The remote SocketAddress to which this {@code EndPoint} is connected, or {@code null}
* if this {@code EndPoint} is not connected to a Socket address.
*/
default SocketAddress getRemoteSocketAddress()
{
return getRemoteAddress();
return null;
}
/**

View File

@ -879,30 +879,12 @@ public class ProxyConnectionFactory extends DetectorConnectionFactory
_endPoint.setIdleTimeout(idleTimeout);
}
@Override
public InetSocketAddress getLocalAddress()
{
SocketAddress local = getLocalSocketAddress();
if (local instanceof InetSocketAddress)
return (InetSocketAddress)local;
return null;
}
@Override
public SocketAddress getLocalSocketAddress()
{
return _local;
}
@Override
public InetSocketAddress getRemoteAddress()
{
SocketAddress remote = getRemoteSocketAddress();
if (remote instanceof InetSocketAddress)
return (InetSocketAddress)remote;
return null;
}
@Override
public SocketAddress getRemoteSocketAddress()
{

View File

@ -52,7 +52,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -103,12 +102,6 @@ public class UnixDomainTest
SocketAddress remote = endPoint.getRemoteSocketAddress();
assertThat(remote, Matchers.instanceOf(UnixDomainSocketAddress.class));
// Verify that other address methods don't throw.
local = assertDoesNotThrow(endPoint::getLocalAddress);
assertNull(local);
remote = assertDoesNotThrow(endPoint::getRemoteAddress);
assertNull(remote);
assertDoesNotThrow(endPoint::toString);
callback.succeeded();

View File

@ -14,7 +14,6 @@
package org.eclipse.jetty.websocket.core.internal;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ReadPendingException;
@ -28,24 +27,12 @@ public class MockEndpoint implements EndPoint
{
public static final String NOT_SUPPORTED = "Not supported by MockEndPoint";
@Override
public InetSocketAddress getLocalAddress()
{
throw new UnsupportedOperationException(NOT_SUPPORTED);
}
@Override
public SocketAddress getLocalSocketAddress()
{
throw new UnsupportedOperationException(NOT_SUPPORTED);
}
@Override
public InetSocketAddress getRemoteAddress()
{
throw new UnsupportedOperationException(NOT_SUPPORTED);
}
@Override
public SocketAddress getRemoteSocketAddress()
{