Package com.epam.common.transport
Class SocketTransport
java.lang.Object
com.epam.common.transport.SocketTransport
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
TCPTransport
Abstract socket implementation of transport.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InputStream
protected OutputStream
protected int
protected int
protected Socket
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the transport.Getter for address value.Getter for address value.int
Getter for local port value.Gets output stream.int
getPort()
Getter for port value.Getter for certificates from sessionGetter for cipher suite from sessionGetter for ssl protocol from sessionboolean
boolean
isOpen()
Returnstrue
if, transport is open.abstract void
open()
Open the transport.int
read
(byte[] buffer) Transport dependent read method.int
read
(byte[] buffer, int offset, int length) Transport dependent read method.int
read
(ByteBuffer buffer) int
read
(ByteBuffer buffer, int offset, int length) void
void
write
(byte[] message) Transport dependent write method.int
write
(byte[] message, int offset, int length) Transport dependent write method.int
write
(ByteBuffer buffer) int
write
(ByteBuffer buffer, int offset, int length)
-
Field Details
-
socket
-
is
-
os
-
sendBufferSize
protected int sendBufferSize -
receiveBufferSize
protected int receiveBufferSize
-
-
Constructor Details
-
SocketTransport
public SocketTransport()
-
-
Method Details
-
getInputStream
-
isBlockingSocket
public boolean isBlockingSocket()- Specified by:
isBlockingSocket
in interfaceTransport
-
getOutputStream
Gets output stream.- Returns:
- output stream
-
read
Description copied from interface:Transport
Transport dependent read method.- Specified by:
read
in interfaceTransport
- Parameters:
buffer
- holder for read bytesoffset
- in bufferlength
- maximum bytes to be read- Returns:
- number of byte actually read
- Throws:
IOException
- if unable to read- See Also:
-
read
Description copied from interface:Transport
Transport dependent read method.- Specified by:
read
in interfaceTransport
- Parameters:
buffer
- holder for read bytes- Returns:
- number of byte actually read
- Throws:
IOException
- if unable to read- See Also:
-
write
Description copied from interface:Transport
Transport dependent write method.- Specified by:
write
in interfaceTransport
- Parameters:
message
- actual message- Throws:
IOException
- if unable to write- See Also:
-
write
Description copied from interface:Transport
Transport dependent write method.- Specified by:
write
in interfaceTransport
- Parameters:
message
- actual messageoffset
- the offset in bufferlength
- the num of bytes to write- Throws:
IOException
- if unable to write
-
write
- Specified by:
write
in interfaceTransport
- Throws:
IOException
-
write
- Specified by:
write
in interfaceTransport
- Throws:
IOException
-
read
- Specified by:
read
in interfaceTransport
- Throws:
IOException
-
read
- Specified by:
read
in interfaceTransport
- Throws:
IOException
-
waitUntilReadyToWrite
- Specified by:
waitUntilReadyToWrite
in interfaceTransport
- Throws:
IOException
-
getAddress
Description copied from interface:Transport
Getter for address value.- Specified by:
getAddress
in interfaceTransport
- See Also:
-
getInetAddress
Description copied from interface:Transport
Getter for address value.- Specified by:
getInetAddress
in interfaceTransport
-
getPort
public int getPort()Description copied from interface:Transport
Getter for port value. -
getLocalPort
public int getLocalPort()Getter for local port value.- Specified by:
getLocalPort
in interfaceTransport
-
close
Description copied from interface:Transport
Close the transport.- Specified by:
close
in interfaceTransport
- Throws:
IOException
- - throws if error occurred- See Also:
-
open
Description copied from interface:Transport
Open the transport.- Specified by:
open
in interfaceTransport
- Throws:
IOException
- - throws if error occurred- See Also:
-
isOpen
public boolean isOpen()Description copied from interface:Transport
Returnstrue
if, transport is open. -
getSSLProtocol
Description copied from interface:Transport
Getter for ssl protocol from session- Specified by:
getSSLProtocol
in interfaceTransport
-
getSSLCipherSuite
Description copied from interface:Transport
Getter for cipher suite from session- Specified by:
getSSLCipherSuite
in interfaceTransport
-
getSSLCertificates
Description copied from interface:Transport
Getter for certificates from session- Specified by:
getSSLCertificates
in interfaceTransport
-