You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/02/24 17:22:46 UTC

(commons-net) branch master updated (ac7612af -> a7b18076)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git


    from ac7612af New class does not need to be public
     new cfb7145b Sort members
     new f50f4314 Use final
     new 417601b3 Sort member
     new a7b18076 Less nesting

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/commons/net/ftp/FTPClient.java |  15 +-
 .../org/apache/commons/net/ftp/ModeZSocket.java    | 158 +++++++--------
 .../apache/commons/net/ftp/FTPClientModeZTest.java | 218 +++++++++------------
 3 files changed, 174 insertions(+), 217 deletions(-)


(commons-net) 02/04: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit f50f43145f40a2c0f86c1c7000f0e6b5427cdbee
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 24 12:21:42 2024 -0500

    Use final
---
 .../apache/commons/net/ftp/FTPClientModeZTest.java | 40 +++++++++++-----------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java b/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java
index b37aa1a9..b8d0475d 100644
--- a/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java
@@ -35,7 +35,7 @@ public class FTPClientModeZTest extends TestCase {
         private final int port;
         private final FtpServer ftpServer;
 
-        FtpServerAndPort(FtpServer ftpServer, int port) {
+        FtpServerAndPort(final FtpServer ftpServer, final int port) {
             this.port = port;
             this.ftpServer = ftpServer;
         }
@@ -52,11 +52,11 @@ public class FTPClientModeZTest extends TestCase {
 
         final PropertiesUserManagerFactory propertiesUserManagerFactory = new PropertiesUserManagerFactory();
         final UserManager userManager = propertiesUserManagerFactory.createUserManager();
-        BaseUser user = new BaseUser();
+        final BaseUser user = new BaseUser();
         user.setName(username);
         user.setPassword(password);
 
-        List<Authority> authorities = new ArrayList<Authority>();
+        final List<Authority> authorities = new ArrayList<>();
         authorities.add(new WritePermission());
         user.setAuthorities(authorities);
 
@@ -66,11 +66,11 @@ public class FTPClientModeZTest extends TestCase {
         return userManager;
     }
 
-    private static void runWithFTPserver(Runner runner) throws Exception {
+    private static void runWithFTPserver(final Runner runner) throws Exception {
 
-        String username = "test";
-        String password = "test";
-        FtpServerAndPort ftpServerAndPort = setupPlainFTPserver(username, password);
+        final String username = "test";
+        final String password = "test";
+        final FtpServerAndPort ftpServerAndPort = setupPlainFTPserver(username, password);
         try {
             runner.run(ftpServerAndPort.port, username, password);
         } finally {
@@ -90,11 +90,11 @@ public class FTPClientModeZTest extends TestCase {
         factory.setPort(0);
 
         // replace the default listener
-        Listener listener = factory.createListener();
+        final Listener listener = factory.createListener();
         serverFactory.addListener("default", listener);
 
         // start the server
-        FtpServer server = serverFactory.createServer();
+        final FtpServer server = serverFactory.createServer();
         server.start();
 
         return new FtpServerAndPort(server, listener.getPort());
@@ -113,21 +113,21 @@ public class FTPClientModeZTest extends TestCase {
     public void testRetrievingFiles() throws Exception {
 
         new File(DEFAULT_HOME).mkdirs();
-        String filename = "test_download.txt";
-        String fileContent = "Created at " + Instant.now();
+        final String filename = "test_download.txt";
+        final String fileContent = "Created at " + Instant.now();
         Files.write(Paths.get(DEFAULT_HOME).resolve(filename), fileContent.getBytes(UTF_8));
 
         runWithFTPserver((port, user, password) -> {
-            FTPClient client = new FTPClient();
+            final FTPClient client = new FTPClient();
             try {
                 client.connect("localhost", port);
                 client.login(user, password);
                 assertTrue("Mode Z successfully activated", client.setFileTransferMode(COMPRESSED_MODE_Z_TRANSFER_MODE));
 
-                FTPFile[] files = client.listFiles();
+                final FTPFile[] files = client.listFiles();
                 assertEquals("Only single file in home directory", 1, files.length);
 
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                final ByteArrayOutputStream bos = new ByteArrayOutputStream();
                 assertTrue("File successfully transferred", client.retrieveFile(files[0].getName(), bos));
                 assertEquals("File content is not corrupted", fileContent, new String(bos.toByteArray(), UTF_8));
             } finally {
@@ -139,23 +139,23 @@ public class FTPClientModeZTest extends TestCase {
     public void testStoringFiles() throws Exception {
 
         runWithFTPserver((port, user, password) -> {
-            FTPClient client = new FTPClient();
+            final FTPClient client = new FTPClient();
             try {
                 client.connect("localhost", port);
                 client.login(user, password);
                 assertTrue("Mode Z successfully activated", client.setFileTransferMode(COMPRESSED_MODE_Z_TRANSFER_MODE));
 
-                FTPFile[] filesBeforeUpload = client.listFiles();
+                final FTPFile[] filesBeforeUpload = client.listFiles();
                 assertEquals("No files in home directory before upload", 0, filesBeforeUpload.length);
 
-                String filename = "test_upload.txt";
-                String fileContent = "Created at " + Instant.now();
+                final String filename = "test_upload.txt";
+                final String fileContent = "Created at " + Instant.now();
                 assertTrue("File successfully transferred", client.storeFile(filename, new ByteArrayInputStream(fileContent.getBytes(UTF_8))));
 
-                FTPFile[] filesAfterUpload = client.listFiles();
+                final FTPFile[] filesAfterUpload = client.listFiles();
                 assertEquals("Single file in home directory after upload", 1, filesAfterUpload.length);
 
-                Path p = Paths.get(DEFAULT_HOME, filename);
+                final Path p = Paths.get(DEFAULT_HOME, filename);
                 assertEquals("File content is not corrupted", fileContent, new String(readAllBytes(p), UTF_8));
             } finally {
                 client.logout();


(commons-net) 04/04: Less nesting

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit a7b18076d94d829861b60c2665b53ee6d982efce
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 24 12:22:46 2024 -0500

    Less nesting
---
 src/main/java/org/apache/commons/net/ftp/FTPClient.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/FTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
index d9b67c4f..a354de2a 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -3422,8 +3422,7 @@ public class FTPClient extends FTP implements Configurable {
     private Socket wrapSocketIfModeZisEnabled(final Socket plainSocket) {
         if (fileTransferMode == COMPRESSED_MODE_Z_TRANSFER_MODE) {
             return ModeZSocket.wrap(plainSocket);
-        } else {
-            return plainSocket;
         }
+        return plainSocket;
     }
 }


(commons-net) 01/04: Sort members

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit cfb7145b3e12177bf10ce4d52885c8766ea75a18
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 24 12:21:11 2024 -0500

    Sort members
---
 .../apache/commons/net/ftp/FTPClientModeZTest.java | 204 ++++++++-------------
 1 file changed, 81 insertions(+), 123 deletions(-)

diff --git a/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java b/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java
index a47d1249..b37aa1a9 100644
--- a/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/FTPClientModeZTest.java
@@ -1,34 +1,15 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 package org.apache.commons.net.ftp;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static java.nio.file.Files.readAllBytes;
-import static java.nio.file.Files.write;
 import static org.apache.commons.io.FileUtils.deleteDirectory;
 import static org.apache.commons.net.ftp.FTP.COMPRESSED_MODE_Z_TRANSFER_MODE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.time.Instant;
@@ -45,97 +26,10 @@ import org.apache.ftpserver.listener.ListenerFactory;
 import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
 import org.apache.ftpserver.usermanager.impl.BaseUser;
 import org.apache.ftpserver.usermanager.impl.WritePermission;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class FTPClientModeZTest {
-
-    private static final String DEFAULT_HOME = "ftp_root/";
-    private final boolean useLocalPassiveFTP;
-
-    @Parameters(name = "useLocalPassiveFTP={0}")
-    public static Boolean[] testParameters() {
-        return new Boolean[] { true, false };
-    }
-
-    public FTPClientModeZTest(boolean useLocalPassiveFTP) {
-        this.useLocalPassiveFTP = useLocalPassiveFTP;
-    }
-
-    @Test
-    public void testRetrievingFiles() throws Exception {
-
-        new File(DEFAULT_HOME).mkdirs();
-        String filename = "test_download.txt";
-        String fileContent = "Created at " + Instant.now();
-        write(Paths.get(DEFAULT_HOME).resolve(filename), fileContent.getBytes(UTF_8));
-
-        runWithFTPserver((port, user, password) -> {
-            FTPClient client = new FTPClient();
-            try {
-                client.connect("localhost", port);
-                client.login(user, password);
-                if (useLocalPassiveFTP) {
-                    client.enterLocalPassiveMode();
-                }
-                assertTrue("Mode Z successfully activated",
-                        client.setFileTransferMode(COMPRESSED_MODE_Z_TRANSFER_MODE));
-
-                FTPFile[] files = client.listFiles();
-                assertEquals("Only single file in home directory", 1, files.length);
-
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
-                assertTrue("File successfully transferred", client.retrieveFile(files[0].getName(), bos));
-                assertEquals("File content is not corrupted", fileContent, new String(bos.toByteArray(), UTF_8));
-            } finally {
-                client.logout();
-            }
-        });
-    }
-
-    @Test
-    public void testStoringFiles() throws Exception {
-
-        runWithFTPserver((port, user, password) -> {
-            FTPClient client = new FTPClient();
-            try {
-                client.connect("localhost", port);
-                client.login(user, password);
-                if (useLocalPassiveFTP) {
-                    client.enterLocalPassiveMode();
-                }
-                assertTrue("Mode Z successfully activated",
-                        client.setFileTransferMode(COMPRESSED_MODE_Z_TRANSFER_MODE));
 
-                FTPFile[] filesBeforeUpload = client.listFiles();
-                assertEquals("No files in home directory before upload", 0, filesBeforeUpload.length);
-
-                String filename = "test_upload.txt";
-                String fileContent = "Created at " + Instant.now();
-                assertTrue("File successfully transferred",
-                        client.storeFile(filename, new ByteArrayInputStream(fileContent.getBytes(UTF_8))));
+import junit.framework.TestCase;
 
-                FTPFile[] filesAfterUpload = client.listFiles();
-                assertEquals("Single file in home directory after upload", 1, filesAfterUpload.length);
-
-                Path p = Paths.get(DEFAULT_HOME, filename);
-                assertEquals("File content is not corrupted", fileContent, new String(readAllBytes(p), UTF_8));
-            } finally {
-                client.logout();
-            }
-        });
-    }
-
-    @Before
-    @After
-    public void cleanup() throws IOException {
-        deleteDirectory(new File(DEFAULT_HOME));
-    }
+public class FTPClientModeZTest extends TestCase {
 
     private static final class FtpServerAndPort {
         private final int port;
@@ -152,6 +46,26 @@ public class FTPClientModeZTest {
         void run(int port, String user, String password) throws Exception;
     }
 
+    private static final String DEFAULT_HOME = "ftp_root/";
+
+    private static UserManager initUserManager(final String username, final String password) throws FtpException {
+
+        final PropertiesUserManagerFactory propertiesUserManagerFactory = new PropertiesUserManagerFactory();
+        final UserManager userManager = propertiesUserManagerFactory.createUserManager();
+        BaseUser user = new BaseUser();
+        user.setName(username);
+        user.setPassword(password);
+
+        List<Authority> authorities = new ArrayList<Authority>();
+        authorities.add(new WritePermission());
+        user.setAuthorities(authorities);
+
+        new File(DEFAULT_HOME).mkdirs();
+        user.setHomeDirectory(DEFAULT_HOME);
+        userManager.save(user);
+        return userManager;
+    }
+
     private static void runWithFTPserver(Runner runner) throws Exception {
 
         String username = "test";
@@ -164,8 +78,7 @@ public class FTPClientModeZTest {
         }
     }
 
-    private static FtpServerAndPort setupPlainFTPserver(final String username, final String password)
-            throws FtpException {
+    private static FtpServerAndPort setupPlainFTPserver(final String username, final String password) throws FtpException {
 
         final FtpServerFactory serverFactory = new FtpServerFactory();
 
@@ -187,22 +100,67 @@ public class FTPClientModeZTest {
         return new FtpServerAndPort(server, listener.getPort());
     }
 
-    private static UserManager initUserManager(final String username, final String password) throws FtpException {
+    @Override
+    protected void setUp() throws IOException {
+        deleteDirectory(new File(DEFAULT_HOME));
+    }
 
-        final PropertiesUserManagerFactory propertiesUserManagerFactory = new PropertiesUserManagerFactory();
-        final UserManager userManager = propertiesUserManagerFactory.createUserManager();
-        BaseUser user = new BaseUser();
-        user.setName(username);
-        user.setPassword(password);
+    @Override
+    protected void tearDown() throws Exception {
+        deleteDirectory(new File(DEFAULT_HOME));
+    }
 
-        List<Authority> authorities = new ArrayList<Authority>();
-        authorities.add(new WritePermission());
-        user.setAuthorities(authorities);
+    public void testRetrievingFiles() throws Exception {
 
         new File(DEFAULT_HOME).mkdirs();
-        user.setHomeDirectory(DEFAULT_HOME);
-        userManager.save(user);
-        return userManager;
+        String filename = "test_download.txt";
+        String fileContent = "Created at " + Instant.now();
+        Files.write(Paths.get(DEFAULT_HOME).resolve(filename), fileContent.getBytes(UTF_8));
+
+        runWithFTPserver((port, user, password) -> {
+            FTPClient client = new FTPClient();
+            try {
+                client.connect("localhost", port);
+                client.login(user, password);
+                assertTrue("Mode Z successfully activated", client.setFileTransferMode(COMPRESSED_MODE_Z_TRANSFER_MODE));
+
+                FTPFile[] files = client.listFiles();
+                assertEquals("Only single file in home directory", 1, files.length);
+
+                ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                assertTrue("File successfully transferred", client.retrieveFile(files[0].getName(), bos));
+                assertEquals("File content is not corrupted", fileContent, new String(bos.toByteArray(), UTF_8));
+            } finally {
+                client.logout();
+            }
+        });
+    }
+
+    public void testStoringFiles() throws Exception {
+
+        runWithFTPserver((port, user, password) -> {
+            FTPClient client = new FTPClient();
+            try {
+                client.connect("localhost", port);
+                client.login(user, password);
+                assertTrue("Mode Z successfully activated", client.setFileTransferMode(COMPRESSED_MODE_Z_TRANSFER_MODE));
+
+                FTPFile[] filesBeforeUpload = client.listFiles();
+                assertEquals("No files in home directory before upload", 0, filesBeforeUpload.length);
+
+                String filename = "test_upload.txt";
+                String fileContent = "Created at " + Instant.now();
+                assertTrue("File successfully transferred", client.storeFile(filename, new ByteArrayInputStream(fileContent.getBytes(UTF_8))));
+
+                FTPFile[] filesAfterUpload = client.listFiles();
+                assertEquals("Single file in home directory after upload", 1, filesAfterUpload.length);
+
+                Path p = Paths.get(DEFAULT_HOME, filename);
+                assertEquals("File content is not corrupted", fileContent, new String(readAllBytes(p), UTF_8));
+            } finally {
+                client.logout();
+            }
+        });
     }
 
 }


(commons-net) 03/04: Sort member

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit 417601b34b5d261f892855f0e4c32c6033607b5b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 24 12:21:58 2024 -0500

    Sort member
---
 .../java/org/apache/commons/net/ftp/FTPClient.java |  16 +--
 .../org/apache/commons/net/ftp/ModeZSocket.java    | 158 ++++++++++-----------
 2 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/FTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
index 5babcb6f..d9b67c4f 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -794,14 +794,6 @@ public class FTPClient extends FTP implements Configurable {
         return socket;
     }
 
-    private Socket wrapSocketIfModeZisEnabled(final Socket plainSocket) {
-        if (fileTransferMode == COMPRESSED_MODE_Z_TRANSFER_MODE) {
-            return ModeZSocket.wrap(plainSocket);
-        } else {
-            return plainSocket;
-        }
-    }
-
     protected void _parseExtendedPassiveModeReply(String reply) throws MalformedServerReplyException {
         reply = reply.substring(reply.indexOf('(') + 1, reply.indexOf(')')).trim();
 
@@ -3426,4 +3418,12 @@ public class FTPClient extends FTP implements Configurable {
     public boolean structureMount(final String pathname) throws IOException {
         return FTPReply.isPositiveCompletion(smnt(pathname));
     }
+
+    private Socket wrapSocketIfModeZisEnabled(final Socket plainSocket) {
+        if (fileTransferMode == COMPRESSED_MODE_Z_TRANSFER_MODE) {
+            return ModeZSocket.wrap(plainSocket);
+        } else {
+            return plainSocket;
+        }
+    }
 }
diff --git a/src/main/java/org/apache/commons/net/ftp/ModeZSocket.java b/src/main/java/org/apache/commons/net/ftp/ModeZSocket.java
index b97bab73..fad29b70 100644
--- a/src/main/java/org/apache/commons/net/ftp/ModeZSocket.java
+++ b/src/main/java/org/apache/commons/net/ftp/ModeZSocket.java
@@ -35,14 +35,24 @@ import java.util.zip.InflaterInputStream;
  */
 class ModeZSocket extends Socket {
 
+    static Socket wrap(final Socket plain) {
+        return new ModeZSocket(plain);
+    }
+
     private final Socket delegate;
 
     private ModeZSocket(final Socket delegate) {
         this.delegate = delegate;
     }
 
-    static Socket wrap(final Socket plain) {
-        return new ModeZSocket(plain);
+    @Override
+    public void bind(final SocketAddress bindpoint) throws IOException {
+        delegate.bind(bindpoint);
+    }
+
+    @Override
+    public synchronized void close() throws IOException {
+        delegate.close();
     }
 
     @Override
@@ -56,8 +66,8 @@ class ModeZSocket extends Socket {
     }
 
     @Override
-    public void bind(final SocketAddress bindpoint) throws IOException {
-        delegate.bind(bindpoint);
+    public SocketChannel getChannel() {
+        return delegate.getChannel();
     }
 
     @Override
@@ -66,23 +76,23 @@ class ModeZSocket extends Socket {
     }
 
     @Override
-    public InetAddress getLocalAddress() {
-        return delegate.getLocalAddress();
+    public InputStream getInputStream() throws IOException {
+        return new InflaterInputStream(delegate.getInputStream());
     }
 
     @Override
-    public int getPort() {
-        return delegate.getPort();
+    public boolean getKeepAlive() throws SocketException {
+        return delegate.getKeepAlive();
     }
 
     @Override
-    public int getLocalPort() {
-        return delegate.getLocalPort();
+    public InetAddress getLocalAddress() {
+        return delegate.getLocalAddress();
     }
 
     @Override
-    public SocketAddress getRemoteSocketAddress() {
-        return delegate.getRemoteSocketAddress();
+    public int getLocalPort() {
+        return delegate.getLocalPort();
     }
 
     @Override
@@ -91,33 +101,38 @@ class ModeZSocket extends Socket {
     }
 
     @Override
-    public SocketChannel getChannel() {
-        return delegate.getChannel();
+    public boolean getOOBInline() throws SocketException {
+        return delegate.getOOBInline();
     }
 
     @Override
-    public InputStream getInputStream() throws IOException {
-        return new InflaterInputStream(delegate.getInputStream());
+    public OutputStream getOutputStream() throws IOException {
+        return new DeflaterOutputStream(delegate.getOutputStream());
     }
 
     @Override
-    public OutputStream getOutputStream() throws IOException {
-        return new DeflaterOutputStream(delegate.getOutputStream());
+    public int getPort() {
+        return delegate.getPort();
     }
 
     @Override
-    public void setTcpNoDelay(final boolean on) throws SocketException {
-        delegate.setTcpNoDelay(on);
+    public synchronized int getReceiveBufferSize() throws SocketException {
+        return delegate.getReceiveBufferSize();
     }
 
     @Override
-    public boolean getTcpNoDelay() throws SocketException {
-        return delegate.getTcpNoDelay();
+    public SocketAddress getRemoteSocketAddress() {
+        return delegate.getRemoteSocketAddress();
     }
 
     @Override
-    public void setSoLinger(final boolean on, final int linger) throws SocketException {
-        delegate.setSoLinger(on, linger);
+    public boolean getReuseAddress() throws SocketException {
+        return delegate.getReuseAddress();
+    }
+
+    @Override
+    public synchronized int getSendBufferSize() throws SocketException {
+        return delegate.getSendBufferSize();
     }
 
     @Override
@@ -126,48 +141,48 @@ class ModeZSocket extends Socket {
     }
 
     @Override
-    public void sendUrgentData(final int data) throws IOException {
-        delegate.sendUrgentData(data);
+    public synchronized int getSoTimeout() throws SocketException {
+        return delegate.getSoTimeout();
     }
 
     @Override
-    public void setOOBInline(final boolean on) throws SocketException {
-        delegate.setOOBInline(on);
+    public boolean getTcpNoDelay() throws SocketException {
+        return delegate.getTcpNoDelay();
     }
 
     @Override
-    public boolean getOOBInline() throws SocketException {
-        return delegate.getOOBInline();
+    public int getTrafficClass() throws SocketException {
+        return delegate.getTrafficClass();
     }
 
     @Override
-    public synchronized void setSoTimeout(final int timeout) throws SocketException {
-        delegate.setSoTimeout(timeout);
+    public boolean isBound() {
+        return delegate.isBound();
     }
 
     @Override
-    public synchronized int getSoTimeout() throws SocketException {
-        return delegate.getSoTimeout();
+    public boolean isClosed() {
+        return delegate.isClosed();
     }
 
     @Override
-    public synchronized void setSendBufferSize(final int size) throws SocketException {
-        delegate.setSendBufferSize(size);
+    public boolean isConnected() {
+        return delegate.isConnected();
     }
 
     @Override
-    public synchronized int getSendBufferSize() throws SocketException {
-        return delegate.getSendBufferSize();
+    public boolean isInputShutdown() {
+        return delegate.isInputShutdown();
     }
 
     @Override
-    public synchronized void setReceiveBufferSize(final int size) throws SocketException {
-        delegate.setReceiveBufferSize(size);
+    public boolean isOutputShutdown() {
+        return delegate.isOutputShutdown();
     }
 
     @Override
-    public synchronized int getReceiveBufferSize() throws SocketException {
-        return delegate.getReceiveBufferSize();
+    public void sendUrgentData(final int data) throws IOException {
+        delegate.sendUrgentData(data);
     }
 
     @Override
@@ -176,18 +191,18 @@ class ModeZSocket extends Socket {
     }
 
     @Override
-    public boolean getKeepAlive() throws SocketException {
-        return delegate.getKeepAlive();
+    public void setOOBInline(final boolean on) throws SocketException {
+        delegate.setOOBInline(on);
     }
 
     @Override
-    public void setTrafficClass(final int tc) throws SocketException {
-        delegate.setTrafficClass(tc);
+    public void setPerformancePreferences(final int connectionTime, final int latency, final int bandwidth) {
+        delegate.setPerformancePreferences(connectionTime, latency, bandwidth);
     }
 
     @Override
-    public int getTrafficClass() throws SocketException {
-        return delegate.getTrafficClass();
+    public synchronized void setReceiveBufferSize(final int size) throws SocketException {
+        delegate.setReceiveBufferSize(size);
     }
 
     @Override
@@ -196,57 +211,42 @@ class ModeZSocket extends Socket {
     }
 
     @Override
-    public boolean getReuseAddress() throws SocketException {
-        return delegate.getReuseAddress();
-    }
-
-    @Override
-    public synchronized void close() throws IOException {
-        delegate.close();
-    }
-
-    @Override
-    public void shutdownInput() throws IOException {
-        delegate.shutdownInput();
-    }
-
-    @Override
-    public void shutdownOutput() throws IOException {
-        delegate.shutdownOutput();
+    public synchronized void setSendBufferSize(final int size) throws SocketException {
+        delegate.setSendBufferSize(size);
     }
 
     @Override
-    public String toString() {
-        return delegate.toString();
+    public void setSoLinger(final boolean on, final int linger) throws SocketException {
+        delegate.setSoLinger(on, linger);
     }
 
     @Override
-    public boolean isConnected() {
-        return delegate.isConnected();
+    public synchronized void setSoTimeout(final int timeout) throws SocketException {
+        delegate.setSoTimeout(timeout);
     }
 
     @Override
-    public boolean isBound() {
-        return delegate.isBound();
+    public void setTcpNoDelay(final boolean on) throws SocketException {
+        delegate.setTcpNoDelay(on);
     }
 
     @Override
-    public boolean isClosed() {
-        return delegate.isClosed();
+    public void setTrafficClass(final int tc) throws SocketException {
+        delegate.setTrafficClass(tc);
     }
 
     @Override
-    public boolean isInputShutdown() {
-        return delegate.isInputShutdown();
+    public void shutdownInput() throws IOException {
+        delegate.shutdownInput();
     }
 
     @Override
-    public boolean isOutputShutdown() {
-        return delegate.isOutputShutdown();
+    public void shutdownOutput() throws IOException {
+        delegate.shutdownOutput();
     }
 
     @Override
-    public void setPerformancePreferences(final int connectionTime, final int latency, final int bandwidth) {
-        delegate.setPerformancePreferences(connectionTime, latency, bandwidth);
+    public String toString() {
+        return delegate.toString();
     }
 }