/** * Returns the address to which the socket is connected. Useful for testing * against an ensemble - test client may need to know which server * to shutdown if interested in verifying that the code handles * disconnection/reconnection correctly. * THIS METHOD IS EXPECTED TO BE USED FOR TESTING ONLY!!! * * @since 3.3.0 * * @return ip address of the remote side of the connection or null if * not connected */ protected SocketAddress testableRemoteSocketAddress() { return cnxn.getRemoteSocketAddress(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); SocketAddress local = getLocalSocketAddress(); SocketAddress remote = getRemoteSocketAddress(); sb .append("sessionid:0x").append(Long.toHexString(getSessionId())) .append(" local:").append(local) .append(" remoteserver:").append(remote) .append(" lastZxid:").append(lastZxid) .append(" xid:").append(xid) .append(" sent:").append(sendThread.sentCount) .append(" recv:").append(sendThread.recvCount) .append(" queuedpkts:").append(outgoingQueue.size()) .append(" pendingresp:").append(pendingQueue.size()) .append(" queuedevents:").append(eventThread.waitingEvents.size()); return sb.toString(); }