- this.source = source;
- try {
- logger.info(String.format("Connecting to %s:%d...", server, port));
- final Socket socket = new Socket(server, port);
- logger.info("Connected.");
- final OutputStream socketOutputStream = socket.getOutputStream();
- final InputStream socketInputStream = socket.getInputStream();
-
- sendLine(socketOutputStream, String.format("SOURCE /%s ICE/1.0", mountPoint));
- sendLine(socketOutputStream, String.format("Authorization: Basic %s", generatePassword(password)));
- sendLine(socketOutputStream, String.format("Content-Type: %s", getContentType(source.metadata())));
- sendLine(socketOutputStream, String.format("ICE-Name: %s", serverName));
- sendLine(socketOutputStream, String.format("ICE-Description: %s", serverDescription));
- sendLine(socketOutputStream, String.format("ICE-Genre: %s", genre));
- sendLine(socketOutputStream, String.format("ICE-Public: %d", publishServer ? 1 : 0));
- sendLine(socketOutputStream, "");
- socketOutputStream.flush();
-
- new Thread(new InputStreamDrainer(socketInputStream)).start();
- new Thread(new Connection(source) {
-
- private long counter;
-
- @Override
- protected int bufferSize() {
- return 4096;
- }