773 if (Debug.debug) Debug.print(Debug.INFO,
"Connecting to " + address);
774 OutputStream out = null;
775 InputStream in = null;
776 UnixSocket us = null;
780 if (
"unix".equals(address.getType())) {
781 types = SASL.AUTH_EXTERNAL;
782 mode = SASL.MODE_CLIENT;
783 us =
new UnixSocket();
784 if (null != address.getParameter(
"abstract"))
785 us.connect(
new UnixSocketAddress(address.getParameter(
"abstract"),
true));
786 else if (null != address.getParameter(
"path"))
787 us.connect(
new UnixSocketAddress(address.getParameter(
"path"),
false));
788 us.setPassCred(
true);
789 in = us.getInputStream();
790 out = us.getOutputStream();
791 }
else if (
"tcp".equals(address.getType())) {
792 types = SASL.AUTH_SHA;
793 if (null != address.getParameter(
"listen")) {
794 mode = SASL.MODE_SERVER;
795 ServerSocket ss =
new ServerSocket();
796 ss.bind(
new InetSocketAddress(address.getParameter(
"host"), Integer.parseInt(address.getParameter(
"port"))));
799 mode = SASL.MODE_CLIENT;
801 s.connect(
new InetSocketAddress(address.getParameter(
"host"), Integer.parseInt(address.getParameter(
"port"))));
803 in = s.getInputStream();
804 out = s.getOutputStream();
806 throw new IOException(getString(
"unknownAddress") + address.getType());
809 if (!(
new SASL()).auth(mode, types, address.getParameter(
"guid"), out, in, us)) {
811 throw new IOException(getString(
"errorAuth"));
814 if (Debug.debug) Debug.print(Debug.VERBOSE,
"Setting timeout to " + timeout +
" on Socket");
816 us.setBlocking(
false);
818 us.setSoTimeout(timeout);
821 if (Debug.debug) Debug.print(Debug.VERBOSE,
"Setting timeout to " + timeout +
" on Socket");
822 s.setSoTimeout(timeout);
824 mout =
new MessageWriter(out);
825 min =
new MessageReader(in);
MessageReader min
Definition: Transport.java:734
MessageWriter mout
Definition: Transport.java:735