Package net.md_5.bungee.api.connection

# Interface Connection

All Known Subinterfaces:
  `ConnectedPlayer`, `PendingConnection`, `ProxiedPlayer`, `Server`

public interface Connection
A proxy connection is defined as a connection directly connected to a socket. It should expose information about the remote peer, however not be specific to a type of connection, whether server or player.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `Connection.Unsafe`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `disconnect(String reason)`
  Deprecated.
  `void`
  `disconnect(BaseComponent reason)`
  Disconnects this end of the connection for the specified reason.
  `void`
  `disconnect(BaseComponent... reason)`
  Disconnects this end of the connection for the specified reason.
  `InetSocketAddress`
  `getAddress()`
  Deprecated.
  BungeeCord can accept connections via Unix domain sockets
  `SocketAddress`
  `getSocketAddress()`
  Gets the remote address of this connection.
  `boolean`
  `isConnected()`
  Gets whether this connection is currently open, ie: not disconnected, and able to send / receive data.
  `Connection.Unsafe`
  `unsafe()`
  Get the unsafe methods of this class.

- ## Method Details

  - ### getAddress

    @Deprecated InetSocketAddress getAddress()
    Deprecated.
    BungeeCord can accept connections via Unix domain sockets
    Gets the remote address of this connection.
    Returns:
      the remote address

  - ### getSocketAddress

    SocketAddress getSocketAddress()
    Gets the remote address of this connection.
    Returns:
      the remote address

  - ### disconnect

    @Deprecated void disconnect(String reason)
    Deprecated.
    Disconnects this end of the connection for the specified reason. If this is an `ProxiedPlayer` the respective server connection will be closed too.
    Parameters:
      `reason` - the reason shown to the player / sent to the server on disconnect

  - ### disconnect

    void disconnect(BaseComponent... reason)
    Disconnects this end of the connection for the specified reason. If this is an `ProxiedPlayer` the respective server connection will be closed too.
    Parameters:
      `reason` - the reason shown to the player / sent to the server on disconnect

  - ### disconnect

    void disconnect(BaseComponent reason)
    Disconnects this end of the connection for the specified reason. If this is an `ProxiedPlayer` the respective server connection will be closed too.
    Parameters:
      `reason` - the reason shown to the player / sent to the server on disconnect

  - ### isConnected

    boolean isConnected()
    Gets whether this connection is currently open, ie: not disconnected, and able to send / receive data.
    Returns:
      current connection status

  - ### unsafe

    Connection.Unsafe unsafe()
    Get the unsafe methods of this class.
    Returns:
      the unsafe method interface