public class Connection extends java.lang.Object implements java.io.Closeable, PacketReceiver<SMBPacket<?>>
| Constructor and Description |
|---|
Connection(Connection connection) |
Connection(SmbConfig config,
SMBClient client,
SMBEventBus bus) |
| Modifier and Type | Method and Description |
|---|---|
Session |
authenticate(AuthenticationContext authContext)
Authenticate the user on this connection in order to start a (new) session.
|
void |
close() |
void |
close(boolean force)
Close the Connection.
|
void |
connect(java.lang.String hostname,
int port) |
SMBClient |
getClient() |
SmbConfig |
getConfig() |
ConnectionInfo |
getConnectionInfo() |
NegotiatedProtocol |
getNegotiatedProtocol()
Returns the negotiated protocol details for this connection.
|
java.lang.String |
getRemoteHostname() |
void |
handle(SMBPacket uncheckedPacket) |
void |
handleError(java.lang.Throwable t) |
boolean |
isConnected() |
<T extends SMB2Packet> |
send(SMB2Packet packet)
send a packet.
|
public Connection(SmbConfig config, SMBClient client, SMBEventBus bus)
public Connection(Connection connection)
public SMBClient getClient()
public void connect(java.lang.String hostname,
int port)
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void close(boolean force)
throws java.io.IOException
force is set to true, it forgoes the Session.close() operation on the open sessions, and it just
calls the TransportLayer.disconnect().force - if set, does not nicely terminate the open sessions.java.io.IOException - If any error occurred during close-ing.public SmbConfig getConfig()
public Session authenticate(AuthenticationContext authContext)
public <T extends SMB2Packet> java.util.concurrent.Future<T> send(SMB2Packet packet) throws TransportException
packet - SMBPacket to sendTransportException - When a transport level error occurredpublic NegotiatedProtocol getNegotiatedProtocol()
public void handle(SMBPacket uncheckedPacket) throws TransportException
handle in interface PacketReceiver<SMBPacket<?>>TransportExceptionpublic void handleError(java.lang.Throwable t)
handleError in interface PacketReceiver<SMBPacket<?>>public java.lang.String getRemoteHostname()
public boolean isConnected()
public ConnectionInfo getConnectionInfo()